Skip to content

Commit 6a2f8b1

Browse files
author
Kilian Schulte
committed
update record docs
1 parent 1b5169e commit 6a2f8b1

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

packages/dart_mappable/doc/records.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,13 @@ void main() {
5555
}
5656
```
5757

58-
## Renaming Record Properties
58+
### Renaming Record Properties
5959

60-
You can also annotate individual fields of a record alias to change the key:
60+
You can also annotate individual fields of a record alias to change the key or add a hook:
6161

6262
```dart
6363
@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"}
64+
typedef FullName = (@MappableField(key: 'firstName') String, @MappableField(hook: MyHook()) String);
7165
```
7266

7367
This will only work on annotated record type aliases, not inline record fields.

0 commit comments

Comments
 (0)