Flutter "is not a subtype of type" | Is there a way to know which key is causing the failure?

160 Views Asked by At

I'm trying to parse a JSON into a model in Flutter. But I get this error a lot

'String' is not a subtype of type 'Map<String, dynamic>'

Which indicates that the model is expecting a Map but is getting a String instead.

My question is, is there a way to know which JSON key is causing that failure?! instead of printing the JSON and comparing the keys with the models

something like

parsing 'country' failed
'String' is not a subtype of type 'Map<String, dynamic>'

Thanks.

0

There are 0 best solutions below