mapValueOfType<T> function
Returns a valid T
value found at the specified Map key
, null otherwise.
Implementation
T? mapValueOfType<T>(dynamic map, String key) {
final dynamic value = map is Map ? map[key] : null;
if (T == double) {
return double.parse(value.toString()) as T;
}
return value is T ? value : null;
}