decodeNullableListBytes<T> static method

List<T?> decodeNullableListBytes<T>(
  1. Uint8List framed,
  2. T readItem(
    1. RecordReader r
    )
)

Decodes a list of nullable items from framed bytes.

Implementation

static List<T?> decodeNullableListBytes<T>(
  Uint8List framed,
  T Function(RecordReader r) readItem,
) {
  final r = RecordReader.fromFramedBytes(framed);
  final count = r.readInt32();
  return List.generate(count, (_) {
    final hasValue = r.readBool();
    return hasValue ? readItem(r) : null;
  });
}