Unhandled Exception: InternalLinkedHashMap' is not a subtype of type 'List

前端 未结 9 758
夕颜
夕颜 2020-12-15 16:04

I am trying to get the JSON response from the server and output it to the console.

Future login() async {
    var response = await http.get(
            


        
9条回答
  •  臣服心动
    2020-12-15 16:31

    I had the same error using json_annotation, json_serializable, build_runner. It occurs when calling the ClassName.fromJson() method for a class that had a class property (example: class User has a property class Address).

    As a solution, I modified the generated *.g.dart files of each class, by changing Map) to Map) in everywhere there is a deep conversion inside the method _$*FromJson

    The only problem is that you have to change it again every time you regenerate your files.

提交回复
热议问题