mapToInt function
Helper method to convert dynamic value to nullable double
Implementation
int mapToInt(dynamic value) {
if (value == null) {
return 0;
}
if (value is String) {
return int.tryParse(value) ?? 0;
}
if (value is! int) {
return 0;
}
return value;
}