decodeValue method

  1. @override
List decodeValue(
  1. Pipe x,
  2. CType t
)
override

Implementation

@override
List decodeValue(Pipe x, CType t) {
  final tuple = checkType(t);
  if (tuple is! TupleClass) {
    throw ArgumentError.value(t, 't', 'Not a valid tuple type');
  }
  if (tuple._components.length < _components.length) {
    throw RangeError.range(
      tuple._components.length,
      _components.length,
      null,
      'tuple components',
      'Tuple components mismatch',
    );
  }
  final res = [];
  for (final entry in tuple._components.asMap().entries) {
    // [i, wireType]
    final i = entry.key;
    final wireType = entry.value;
    if (i >= _components.length) {
      // skip value
      wireType.decodeValue(x, wireType);
    } else {
      res.add(_components[i].decodeValue(x, wireType));
    }
  }
  return res;
}