Home > OS >  Flutter Error: type 'MappedListIterable<dynamic, dynamic>' is not a subtype of type
Flutter Error: type 'MappedListIterable<dynamic, dynamic>' is not a subtype of type

Time:01-19

I have updated the flutter to 2.8.1 and i dont have any idea as how to solve this

factory SubjectAnalysis.fromJson(Map<String, dynamic> json) =>
      SubjectAnalysis(
        subjectAnalysis: List<List<SubjectAnalysisElement>>.from((
            json['Subject Analysis'].map((dynamic x) =>
                List<SubjectAnalysisElement>.from(
                    ( x.map((dynamic x) => SubjectAnalysisElement.fromJson(x as Map<String, dynamic>)))as List<dynamic>))as List<dynamic>)));

CodePudding user response:

I don’t know which of both casts you have to remove… try to remove both

as List<dynamic>

CodePudding user response:

Try the below code. This is what I understand from the info you have provided.

factory SubjectAnalysis.fromJson(Map<String, dynamic> json) =>
      SubjectAnalysis(
        subjectAnalysis: List<List<SubjectAnalysisElement>>.from((
            json['Subject Analysis'].map((dynamic x) =>
                List<SubjectAnalysisElement>.from(
                    ( x.map((dynamic x) => SubjectAnalysisElement.fromJson(x as Map<String, dynamic>)))as List<dynamic>))as MappedListIterable<dynamic, dynamic>)));
  •  Tags:  
  • Related