I am pretty new to flutter and am getting frustated at this. How do I get rid of the error?
The code:
factory MyAudioList.fromMap(Map<String, dynamic> map) {
return MyAudioList(
audios: List<MyAudio>.from(
map['audios']?.map((x) => MyAudio.fromMap(x as Map<String, dynamic>))
as Iterable<dynamic>),
);
}
CodePudding user response:
Try doing this instead and check if it works:
factory MyAudioList.fromMap(Map<String, dynamic> map) {
return MyAudioList(
audios: List<MyAudio>.from(
map['audios']?.map((Map<String, dynamic> x) => MyAudio.fromMap(x))
as Iterable<dynamic>),
);
}