encodeValue method

  1. @override
Uint8List encodeValue(
  1. List x
)
override

Encode the value. This needs to be public because it is used by encodeValue() from different types. @internal

Implementation

@override
Uint8List encodeValue(List x) {
  if (x.isEmpty) {
    return Uint8List.fromList([0]);
  } else {
    final val = x[0];
    return u8aConcat([
      Uint8List.fromList([1]),
      tryToJson(_type, val) ?? _type.encodeValue(val)
    ]);
  }
}