Serializing JSON using code generation libraries

Although there are other libraries available, this guide uses
json_serializable, an automated source code generator that
generates the JSON serialization boilerplate for you.

Flutter Favorite packages
  on pub.dev that generate JSON serialization code,

json_serializable and

built_value.
  How do you choose between these packages?
  The

Since the serialization code is not handwritten or maintained manually
anymore, you minimize the risk of having JSON serialization exceptions at
runtime.

Setting up json_serializable in a project

To include json_serializable in your project, you need one regular
dependency, and two dev dependencies. In short, dev dependencies
are dependencies that are not included in our app source code—they
are only used in the development environment.

The latest versions of these required dependencies can be seen by
following the pubspec file in the JSON serializable example.

pubspec.yaml