getAccountBalance method
Implementation
Future<String> getAccountBalance(
String adress,
) async {
try {
final accountData = await getAccountInfo(adress);
final amountInDrops = accountData['account_data']['Balance'] as String;
final amountInXrp = XrpFormatter.dropsToXrp(int.parse(amountInDrops));
return amountInXrp.toString();
} catch (err) {
if (err is Map) {
if (err['result']['error'] == 'actNotFound') {
return '0';
} else {
throw Exception(err['result']["error_message"]);
}
}
rethrow;
}
}