computeTransformation method

  1. @override
dynamic computeTransformation(
  1. Object? json
)
override

Implementation

@override
dynamic computeTransformation(Object? json) {
  if (json is List) {
    if (indexes.isEmpty) {
      return json;
    } else if (indexes.length == 1) {
      var index = indexes.first;
      return _getIndexValue(json, index);
    } else {
      return indexes.map((i) => _getIndexValue(json, i)).toList();
    }
  } else if (json is Map) {
    if (indexes.isEmpty) {
      return json.values;
    } else if (indexes.length == 1) {
      var index = indexes[0];
      return _getKeyValue(json, '$index');
    } else {
      return indexes.map((i) => _getKeyValue(json, '$i')).toList();
    }
  }
  return [];
}