I have a code like this
double total = 20.2; int min = total as int;
flutter build was ok but it was exception on runtime.
I have tried int.parse() but it requires string not double.
Do you have any suggestion?
If you want to round the value :
double total = 20.2; int min = total.round();
If you want to just truncate the value :
double total = 20.2; int min = total.toInt();
Answered By – Mann Dave
Answer Checked By – Terry (FlutterFixes Volunteer)