Google is committed to advancing racial equity for Black communities. See how.

encode method

  • @override

void encode (Encoder encoder, T value, int offset) override

Implementation

@override
void encode(Encoder encoder, T value, int offset) {
  validate(value);
  if (value == null) {
    encoder
      ..encodeUint64(0, offset) // count
      ..encodeUint64(kAllocAbsent, offset + 8); // data
  } else {
    final int count = value.length;
    encoder
      ..encodeUint64(count, offset) // count
      ..encodeUint64(kAllocPresent, offset + 8); // data
    int childOffset =
        encoder.alloc(count * element.encodingInlineSize(encoder));
    element.encodeArray(encoder, value, childOffset);
  }
}