asListOfMap function

List<Map>? asListOfMap(
  1. Object? o
)

Returns o as a List<Map>. Converts it if needed.

Implementation

List<Map>? asListOfMap(Object? o) {
  if (o == null) return null;
  if (o is List<Map>) return o;
  if (o is List) {
    return o.map((e) => asMap(e)).whereType<Map>().toList();
  } else if (o is Map) {
    return [o];
  }

  var s = o.toString();
  var map = parseFromInlineMap(
      s, _inlinePropertiesDelimiterPairs, _inlinePropertiesDelimiterKeysValues);
  return [map!];
}