toMapOfStringDoubleN static method

Map<String, double>? toMapOfStringDoubleN(
  1. dynamic d
)

Converts a dynamic value to a nullable map of <String, double>.

d - The dynamic value to be converted. Returns a map of <String, double> if the conversion is successful, otherwise null.

Implementation

static Map<String, double>? toMapOfStringDoubleN(dynamic d) {
  final jsonMap = Convert.toMapN<String, dynamic>(d);
  final Map<String, double> result = {};
  if (jsonMap != null) {
    jsonMap.forEach((key, value) {
      final d = Convert.toDoubleN(value);
      if (d != null) {
        result[key] = d;
      }
    });
  }
  return result;
}