Files
enaklo-flutter/lib/infrastructure/auth/dto/verify_dto.dart
T

33 lines
872 B
Dart
Raw Normal View History

2025-09-18 06:38:50 +07:00
part of '../auth_dtos.dart';
@freezed
abstract class VerifyDto with _$VerifyDto {
2025-09-18 06:38:50 +07:00
const factory VerifyDto({
@JsonKey(name: 'status') String? status,
@JsonKey(name: 'message') String? message,
@JsonKey(name: 'data') VerifyDataDto? data,
}) = _VerifyDto;
factory VerifyDto.fromJson(Map<String, dynamic> json) =>
_$VerifyDtoFromJson(json);
const VerifyDto._(); // biar bisa bikin method
/// mapping ke domain
Verify toDomain() => Verify(
status: status ?? '',
message: message ?? '',
registrationToken: data?.registrationToken ?? '',
);
}
@freezed
abstract class VerifyDataDto with _$VerifyDataDto {
2025-09-18 06:38:50 +07:00
const factory VerifyDataDto({
@JsonKey(name: 'registration_token') String? registrationToken,
}) = _VerifyDataDto;
factory VerifyDataDto.fromJson(Map<String, dynamic> json) =>
_$VerifyDataDtoFromJson(json);
}