createValueList static method

DictionaryValue<Uint8List> createValueList(
  1. int size
)

Returns a standard Uint8List value

Throws 'Invalid buffer size...' if src.length != size

Implementation

static DictionaryValue<Uint8List> createValueList(int size) {
  return DictionaryValue(
    serialize: (src, builder) {
      if (src.length != size) {
        throw 'Invalid buffer size, expected $size, got ${src.length}';
      }
      builder.storeList(src);
    },
    parse: (src) {
      return src.loadList(size);
    },
  );
}