computeOperation method

  1. @override
Map? computeOperation(
  1. Object? json
)
override

Implementation

@override
Map? computeOperation(Object? json) {
  if (json == null) {
    return {};
  } else if (json is Iterable) {
    var tMapEntry = TMapEntry(parameters);
    var entries = json
        .map((e) => tMapEntry.transform(e) as MapEntry?)
        .whereType<MapEntry>()
        .toList();
    return Map.fromEntries(entries);
  } else if (json is MapEntry) {
    return Map.fromEntries([json]);
  } else if (json is Pair) {
    return Map.fromEntries([json.asMapEntry]);
  } else if (json is Map) {
    return json;
  } else if (json is String) {
    var delimiterPairs = getParameter(0);
    var delimiterKeyValue = getParameter(1);
    var delimiterPairsPattern = delimiterPairs != null
        ? RegExp(delimiterPairs)
        : _LIST_DELIMITER_PATTERN;
    var delimiterKeyValuePattern = delimiterPairs != null
        ? RegExp(delimiterKeyValue)
        : _LIST_DELIMITER_PATTERN;
    return parseFromInlineMap(json, delimiterPairsPattern,
        delimiterKeyValuePattern, (s) => s, (s) => s);
  } else {
    return {'/': json};
  }
}