basicTypeToInt function
true as 1, false as 0, null as null, rounded to int
Implementation
int? basicTypeToInt(Object? value) {
/// But most likely to happen first
if (value is int) {
return value;
} else if (value == null) {
return null;
} else if (value is num) {
return value.round();
} else if (value is bool) {
return value ? 1 : 0;
} else if (value is String) {
return _parseInt(value);
} else {
return _parseInt(value.toString());
}
}