26 lines
708 B
Dart
26 lines
708 B
Dart
part of '../wallet_dtos.dart';
|
|
|
|
@freezed
|
|
abstract class OutletDto with _$OutletDto {
|
|
const factory OutletDto({
|
|
@JsonKey(name: 'id') String? id,
|
|
@JsonKey(name: 'name') String? name,
|
|
@JsonKey(name: 'address') String? address,
|
|
@JsonKey(name: 'earns_points') bool? earnsPoints,
|
|
@JsonKey(name: 'earns_coins') bool? earnsCoins,
|
|
}) = _OutletDto;
|
|
|
|
factory OutletDto.fromJson(Map<String, dynamic> json) =>
|
|
_$OutletDtoFromJson(json);
|
|
|
|
const OutletDto._();
|
|
|
|
Outlet toDomain() => Outlet(
|
|
id: id ?? '',
|
|
name: name ?? '',
|
|
address: (address?.trim().isEmpty ?? true) ? null : address!.trim(),
|
|
earnsPoints: earnsPoints ?? false,
|
|
earnsCoins: earnsCoins ?? false,
|
|
);
|
|
}
|