In json_serializable
package we can define a build.yaml
file to configure diffrent options. I have 2 folder for my models, one folder is for requests and the other is for responses.
I want to know how to create build.yaml
with diffrent configuration for both of this folder?
I tried something like this but did not succeed.
targets:
api_package_name:
builders:
json_serializable|request:
enabled: true
generate_for:
- "lib/src/models/request/*.dart"
options:
include_if_null: false
checked: true
create_factory: false
explicit_to_json: true
field_rename: snake
json_serializable|response:
enabled: true
generate_for:
- "lib/src/models/response/*.dart"
options:
checked: true
create_to_json: false
field_rename: snake