getCustomers method
dynamic
getCustomers(
- String appToken
)
Implementation
getCustomers(String appToken) async {
try {
CustomerListResponse customerListResponse = await _customerRepository
.getCustomers(appToken);
if (kDebugMode) {
print("CUSTOMER LIST: $customerListResponse");
}
if (customerListResponse.status == 200) {
customerListSink.add(Response.completed(customerListResponse.data!));
} else {
if (kDebugMode) {
print(
"CUSTOMER LIST FAILED MESSAGE: ${customerListResponse.message}",
);
}
customerListSink.add(Response.error(customerListResponse.message));
}
} on UnauthorisedException {
if (kDebugMode) {
print("CUSTOMER LIST ERROR: ${IPGErrorMessages.invalidAppToken}");
}
customerListSink.add(Response.error(IPGErrorMessages.invalidAppToken));
} catch (e) {
customerListSink.add(Response.error(e.toString()));
if (kDebugMode) {
print("CUSTOMER LIST ERROR: ${e.toString()}");
}
}
}