I have the following in my analysis_options.yaml:-
analyzer:
strong-mode:
implicit-casts: false
When I use the json_serializable and generate to 'fromJson' method, and try to pass, the result from jsonDecode (from base dart::convert package), I get the error message "The argument type 'dynamic' can't be assigned to the parameter type 'Map'". The code runs and works but it's annoying to have these errors around my code, is there any way to keep the implicit converts off but stop this error from appearing?
Having used JsonSerializable the Person example they give in their documentation and trying to use the following call.
factory Person.fromJsonString(String jsonString) {
dynamic test = jsonDecode(jsonString);
return Person.fromJson(test);
}
jsonDecode is typed as dynamic even though it returns a Map<'String,dynamic'> Just seems like an odd point in the language.
Thanks in advance.