mapFromJson static method

Map<String, RuleCollection> mapFromJson(
  1. Map<String, dynamic>? json
)

Implementation

static Map<String, RuleCollection> mapFromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return <String, RuleCollection>{};
  }

  return json.entries.fold(<String, RuleCollection>{},
      (Map<String, RuleCollection> previousValue, element) {
    final RuleCollection? object = RuleCollection.fromJson(element.value);
    if (object is RuleCollection) {
      previousValue[element.key] = object;
    }

    return previousValue;
  });
}