With this approach, the calling code doesn’t have to worry about JSON
serialization at all. However, the model class still definitely has to.
In a production app, you would want to ensure that the serialization
works properly. In practice, the User.fromJson() and User.toJson()
methods both need to have unit tests in place to verify correct behavior.

The cookbook contains a more comprehensive worked example of using
  JSON model classes, using an isolate to parse
  the JSON file on a background thread. This approach is ideal if you
  need your app to remain responsive while the JSON file is being
  decoded.

However, real-world scenarios are not always that simple.
Sometimes JSON API responses are more complex, for example since they 
contain nested JSON objects that must be parsed through their own model
class.

It would be nice if there were something that handled the JSON encoding
and decoding for you.  Luckily, there is!

Serializing JSON using code generation libraries