扑打jsonserialization
我目前正在构建一个应用程序,用户可以在其设备上存储列表项目作为收藏夹。调试我的应用程序我正在以下错误运行:
发生了例外。
_casterror(type'null'不是类型'widget'的亚型)
这是我的代码:
LogEntry _$LogEntryFromJson(Map<String, dynamic> json) {
return LogEntry(
mechanismId: json['mechanismId'] as int?,
timestamp: DateTime.parse(json['timestamp'] as String),
navigation: json['navigation'] as Widget);
}
Map<String, dynamic> _$LogEntryToJson(LogEntry instance) => <String, dynamic>{
'mechanismId': instance.mechanismId,
'timestamp': instance.timestamp.toIso8601String(),
'navigation:': instance.navigation,
};
机械机制是列表项目的各个ID,导航代表详细信息页面的路由。
I am currently building an app where the user is able to store List items as favorites on their device. Debugging my app I am running in the following error:
Exception has occurred.
_CastError (type 'Null' is not a subtype of type 'Widget' in type cast)
This is my code:
LogEntry _$LogEntryFromJson(Map<String, dynamic> json) {
return LogEntry(
mechanismId: json['mechanismId'] as int?,
timestamp: DateTime.parse(json['timestamp'] as String),
navigation: json['navigation'] as Widget);
}
Map<String, dynamic> _$LogEntryToJson(LogEntry instance) => <String, dynamic>{
'mechanismId': instance.mechanismId,
'timestamp': instance.timestamp.toIso8601String(),
'navigation:': instance.navigation,
};
The mechanismID is the respective ID of a List item and the navigation stands for the route of the detail page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)