【发布时间】:2022-01-13 04:00:01
【问题描述】:
我需要将模型分配给应用程序中的列表,但出现标题中提到的错误。
虽然我在android端得到这个错误,但我没有问题,但是当我在ios端尝试时,我的应用程序崩溃了。
List<MessageModel> messageList = [];
String? message;
bool success = false;
@override
MessageService decode(dynamic data) {
messageList = (data as List).map((e) => MessageModel.fromJsonData(e)).toList(); ----> Unhandled Exception: type 'Null' is not a subtype of type 'List<dynamic>' in type cast
return this;
}
【问题讨论】:
标签: ios list flutter casting decode