listPostalCode method
Implementation
@override
Future<Either<Failure, List<PostalCode>>> listPostalCode(
int districtID,
) async {
try {
var result = await apiService.get(
url: Api.address.listPostalCode,
queryParameters: {"districtID": districtID},
withAccessToken: true,
withToken: true,
);
var responseDTO = ListPostalCodeDto.map(result);
return Right(
responseDTO.jsonResult
?.map((e) => AddressDataMapper.mapPostalCodeResponseToDomain(e))
.toList() ??
[],
);
} on Exception catch (error) {
return Left(FailureResponse.mapExceptionToFailure(error));
}
}