Globally configuration for json_serializable in a Flutter project.
Create a file called build.yaml at the root of your Flutter project and paste the code below.
targets:
$default:
builders:
json_serializable:
options:
include_if_null: false
explicit_to_json: true