We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b5169e commit 6a2f8b1Copy full SHA for 6a2f8b1
1 file changed
packages/dart_mappable/doc/records.md
@@ -55,19 +55,13 @@ void main() {
55
}
56
```
57
58
-## Renaming Record Properties
+### Renaming Record Properties
59
60
-You can also annotate individual fields of a record alias to change the key:
+You can also annotate individual fields of a record alias to change the key or add a hook:
61
62
```dart
63
@MappableRecord()
64
-typedef FullName = (@MappableField(key: 'firstName') String, @MappableField(key: 'lastName') String);
65
-```
66
-
67
-This would serialize to:
68
69
-```json
70
-{"firstName": "John", "lastName": "Doe"}
+typedef FullName = (@MappableField(key: 'firstName') String, @MappableField(hook: MyHook()) String);
71
72
73
This will only work on annotated record type aliases, not inline record fields.
0 commit comments