'Why should I explicitly cast my JASON object as a Map<String, dynamic> in Dart?
If the dart convert package returns a json object, is there any advantage or necessity to casting the converted json to a Map<String, dynamic>? In the code below, I'm taking the response from an api and passing it to a factory that returns a Dart Place object. I'm trying to understand the benefit of casting the json as a map versus passing the result as a json object. Thanks for any insights.
var parsedJason = convert.jsonDecode(response.body);
var resultObj = parsedJason['result'] as Map<String, dynamic>;
return Place.fromJson(resultObj);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
