calliLoadBalanceApi method
Future<void>
calliLoadBalanceApi(
)
Implementation
Future<void> calliLoadBalanceApi() async {
BuildContext context = Get.context!;
String? mobileNumber = (SingletonSotrage.secureStorageInterface.readSecureData(
SecureStorageService.preferedUserName,
));
try {
await ApiClient(baseUrl: ApiConstant.posBFF)
.getILoadBalance(
mobileNumber: "855$mobileNumber", userType: "PARTNER")
.then((response) {
isLoadingMore.value = true;
ILoadBalanceModel model = response;
if (model.status == "POS200") {
balance.value = model.data != null
? double.tryParse(model.data!.response![0].balance!)!
: 0.0;
} else {
Helper.messageDialog(
Get.context!,
model.errors![0].code ?? 'tryAgain'.tr,
model.errors![0].localeMessage ?? 'somethingWrong'.tr,
);
}
}).catchError((onError) {
isLoadingMore.value = true;
Helper.messageDialog(context, 'tryAgain'.tr, onError.toString());
});
} catch (e, st) {
print(st);
}
}