fetchfundingSources method
Implementation
void fetchfundingSources(BuildContext context) async {
try {
isLoading(true);
var request = {
'token': Storage.getValue(Constants.token),
'api_key': Constants.apiKey,
'sub_client_api_key': Storage.getValue(Constants.subClientApiKey)
};
var response = await DioClient().request(
context: context, api: '/get-funding-sources', method: Method.POST, params: request);
GetFundingResponse getFundingResponse =
GetFundingResponse.fromJson(response);
if (getFundingResponse.status == Strings.success) {
allCards = getFundingResponse.data!.cards!.obs;
allBankAccounts = getFundingResponse.data!.bankAccounts!.obs;
} else {
isError(true);
errorMessage.value = response['message'].toString().toTitleCase();
return Utils.showSnackbar(
context, Strings.error, response['message'], AppColors.red);
}
} finally {
isLoading(false);
}
update();
}