Mapper<T> class abstract

Contract for mapping data-layer models to domain entities.

Use in repository or service layers to keep persistence/API models separate from business logic types.

class UserMapper implements Mapper<UserEntity> {
  UserMapper(this.dto);

  final UserDto dto;

  @override
  UserEntity toEntity() => UserEntity(
        id: dto.id,
        name: dto.name,
      );
}

Constructors

Mapper()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toEntity() → T
Converts the current object to its domain T representation.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited