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
74
74
flutter pub add --dev json_serializable
75
75
```
76
76
77
- ## 5. Enable ` create_field_map ` of ` json_serializable `
77
+ ## 5. Enable ` create_field_map ` and ` create_per_field_to_json ` of ` json_serializable `
78
78
79
79
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 ` .
81
81
This can be done by creating a ` build.yaml ` file next to your ` pubspec.yaml ` and
82
82
paste the following:
83
83
@@ -88,15 +88,16 @@ targets:
88
88
json_serializable :
89
89
options :
90
90
create_field_map : true
91
+ create_per_field_to_json : true
91
92
` ` `
92
93
93
94
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.
95
96
96
97
Alternatively, you can enable the option on a per-model basis using `json_annotation`'s `@JsonSerializable` object :
97
98
98
99
` ` ` dart
99
- @JsonSerializable(createFieldMap: true)
100
+ @JsonSerializable(createFieldMap: true, createPerFieldToJson: true )
100
101
@Collection<Model>(...)
101
102
class MyModel {...}
102
103
` ` `
You can’t perform that action at this time.
0 commit comments