Skip to content

Commit

Permalink
Merge pull request #20 from netglade/release/1.2.0
Browse files Browse the repository at this point in the history
Bump to 1.2.0, enhance README
  • Loading branch information
tenhobi authored Apr 6, 2023
2 parents 389e69b + ef2f1f4 commit d4198a9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/auto_mappr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Unreleased
## 1.2.0
- Adhere lints to `netglade_analysis` 1.2.0.
- Use tear-offs when possible.
- Omit map when possible.
Expand Down
25 changes: 20 additions & 5 deletions packages/auto_mappr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ or updating the mappings.

Create a mapping class with `@AutoMappr` annotation.
You will also need to import the annotation.
Then use `MapType<Source, Target>()` for each mapping.

```dart
import 'package:auto_mappr_annotation/auto_mappr_annotation.dart';
part 'my_file.g.dart';
@AutoMappr([
MapType<UserDto, User>(),
])
class Mappr extends $Mappr {}
```

Depending on your needs, it can also be heavily customized.
Below you can see just some of its options.
See [features](#-features) for a complete list.

```dart
import 'package:auto_mappr_annotation/auto_mappr_annotation.dart';
Expand All @@ -105,17 +121,16 @@ part 'my_file.g.dart';
@AutoMappr([
MapType<UserDto, User>(
fields: [
Field('name', target: Mappr.mapName),
Field('age', target: mapAge),
Field('address', from: 'userAddress'),
Field('fullName', custom: Mappr.mapFullName),
Field('age', custom: 42),
Field('tag', ignore: true)
],
),
])
class Mappr extends $Mappr {
static String mapName(UserDto dto) => dto.name.toUpperCase();
static String mapFullName(UserDto dto) => '${dto.firstName} ${dto.lastName}';
}
int mapAge(UserDto _) => 55;
```

### Install
Expand Down
2 changes: 1 addition & 1 deletion packages/auto_mappr/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: auto_mappr
description: Code generation for mapping between different objects with ease.
version: 1.1.2
version: 1.2.0
repository: https://github.com/netglade/auto_mappr
issue_tracker: https://github.com/netglade/auto_mappr/issues

Expand Down

0 comments on commit d4198a9

Please sign in to comment.