Skip to content

Commit b14c513

Browse files
authored
docs(cloud_firestore_odm_generator): ODM generator now require create_per_field_to_json: true (#11728)
1 parent dde59d4 commit b14c513

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/cloud_firestore_odm/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ flutter pub add --dev cloud_firestore_odm_generator
7474
flutter 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`.
8181
This can be done by creating a `build.yaml` file next to your `pubspec.yaml` and
8282
paste 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

9697
Alternatively, 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>(...)
101102
class MyModel {...}
102103
```

0 commit comments

Comments
 (0)