Skip to content

Commit

Permalink
improve docs of includeCustomMappers
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilian Schulte committed Sep 25, 2024
1 parent 4777e79 commit 8ba8b51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/dart_mappable/doc/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class Domain {
}
```

Alternatively you can add this to the `MapperContainer.globals` to be globally available to all other mappers.
This will **globally** register the custom mapper when the class is initialized and is afterwards available for all models.

Alternatively you can manually add this to the `MapperContainer.globals`:

```dart
void main() {
Expand Down
6 changes: 5 additions & 1 deletion packages/dart_mappable/lib/src/annotations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,12 @@ abstract class MappableInterface {
/// using the `|` operator.
final int? generateMethods;

/// Specify additional custom mappers that should be included for fields
/// Specify additional custom mappers that should be used for fields
/// of this class.
///
/// This does not scope the mappers to this class only. All mappers are always
/// registered globally and available to all classes. This only makes sure
/// that the needed mappers are registered before they are needed for this class.
final Iterable<MapperBase>? includeCustomMappers;
}

Expand Down

0 comments on commit 8ba8b51

Please sign in to comment.