mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Gracefully handle toast messages error on desktop platforms
This commit is contained in:
parent
d86c501fc5
commit
e527083871
4 changed files with 31 additions and 23 deletions
|
@ -1,7 +1,6 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_zano/zano_wallet_api.dart';
|
||||
import 'package:decimal/decimal.dart';
|
||||
import 'package:decimal/intl.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
@ -57,7 +56,9 @@ class ZanoFormatter {
|
|||
static int parseAmount(String amount, [int decimalPoint = defaultDecimalPoint]) {
|
||||
final resultBigInt = (Decimal.parse(amount) * Decimal.fromBigInt(BigInt.from(10).pow(decimalPoint))).toBigInt();
|
||||
if (!resultBigInt.isValidInt) {
|
||||
Fluttertoast.showToast(msg: 'Cannot transfer $amount. Maximum is ${intAmountToString(resultBigInt.toInt(), decimalPoint)}.');
|
||||
try {
|
||||
Fluttertoast.showToast(msg: 'Cannot transfer $amount. Maximum is ${intAmountToString(resultBigInt.toInt(), decimalPoint)}.');
|
||||
} catch (_) {}
|
||||
}
|
||||
return resultBigInt.toInt();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue