File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/cloud_firestore_odm Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,10 @@ flutter pub add --dev cloud_firestore_odm_generator
7474flutter pub add --dev json_serializable
7575```
7676
77- ## 5. Enable ` create_field_map ` of ` json_serializable `
77+ ## 5. Enable ` create_field_map ` and ` create_per_field_to_json ` of ` json_serializable `
7878
7979
80- For the ODM to work, it is necessary to enable the ` create_field_map ` of ` json_serializable ` .
80+ For the ODM to work, it is necessary to enable the ` create_field_map ` and ` create_per_field_to_json ` of ` json_serializable ` .
8181This can be done by creating a ` build.yaml ` file next to your ` pubspec.yaml ` and
8282paste the following:
8383
@@ -88,15 +88,16 @@ targets:
8888 json_serializable :
8989 options :
9090 create_field_map : true
91+ create_per_field_to_json : true
9192` ` `
9293
9394
94- This will enable ` create_field_map` for the entire project.
95+ This will enable ` create_field_map` and `create_per_field_to_json` for the entire project.
9596
9697Alternatively, you can enable the option on a per-model basis using `json_annotation`'s `@JsonSerializable` object :
9798
9899` ` ` dart
99- @JsonSerializable(createFieldMap: true)
100+ @JsonSerializable(createFieldMap: true, createPerFieldToJson: true )
100101@Collection<Model>(...)
101102class MyModel {...}
102103` ` `
You can’t perform that action at this time.
0 commit comments