toNumber function
Implementation
num? toNumber(dynamic value, {bool showException = false}) {
if (value == null) {
return null;
}
if (value is num) {
return value;
}
if (value is! String) {
if (showException) {
throw Exception('Only String and num allowed.');
}
return null;
}
return double.tryParse(value.toString().trim());
}