Home > database >  Try adding an explicit type, or remove implicit-dynamic from your analysis options file
Try adding an explicit type, or remove implicit-dynamic from your analysis options file

Time:02-12

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>),
    );
  }

The error: enter image description here

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>),
    );
  }
  • Related