asIntOrNull method
Returns the picked value as int? or returns null
when the picked
value is absent
Parses the picked value as int. Also tries to parse String as int
Set roundDouble
to round double to int
Set truncateDouble
to cut off decimals
roundDouble
and truncateDouble
can not be true at the same time
via int.tryParse
Implementation
int? asIntOrNull({bool roundDouble = false, bool truncateDouble = false}) {
if (value == null) return null;
try {
return _parse(roundDouble, truncateDouble);
} catch (_) {
return null;
}
}