custom_mapper 0.0.2 copy "custom_mapper: ^0.0.2" to clipboard
custom_mapper: ^0.0.2 copied to clipboard

A powerful code generation package for creating type-safe mappers between domain objects and data transfer objects (DTOs) in Dart and Flutter applications.

custom_mapper #

A powerful code generation package for creating type-safe mappers between domain objects and data transfer objects (DTOs) in Dart and Flutter applications.

Installation #

Add both packages to your pubspec.yaml:

dependencies:
  custom_mapper_annotation: ^0.0.1

dev_dependencies:
  custom_mapper: ^0.0.1
  build_runner: ^2.4.13

Usage #

  1. Import the annotation package
  2. Annotate your DTO classes
  3. Run code generation
import 'package:custom_mapper_annotation/custom_mapper_annotation.dart';

@Mapper(domain: User, toDomain: true, toData: true)
class UserDto {
  final String name;
  final int age;
  final String email;

  const UserDto({
    required this.name,
    required this.age,
    required this.email,
  });
}

Then run:

dart run build_runner build

This will generate mapping extensions for your classes.

0
likes
0
points
443
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful code generation package for creating type-safe mappers between domain objects and data transfer objects (DTOs) in Dart and Flutter applications.

Repository (GitHub)
View/report issues

Topics

#codegen #mapper #dto #code-generation #build-runner

License

unknown (license)

Dependencies

analyzer, build, collection, custom_mapper_annotation, source_gen

More

Packages that depend on custom_mapper