decode static method
Implementation
static (BTreeKey key, int consumed) decode(Uint8List data, int offset) {
final bd = ByteData.sublistView(data);
final type = data[offset];
final len = bd.getUint16(offset + 1, Endian.little);
switch (type) {
case _keyTypeInt:
return (BTreeKey(bd.getInt64(offset + 3, Endian.little)), 1 + 2 + 8);
case _keyTypeFloat:
return (BTreeKey(bd.getFloat64(offset + 3, Endian.little)), 1 + 2 + 8);
default:
final s = utf8.decode(data.sublist(offset + 3, offset + 3 + len));
return (BTreeKey(s), 1 + 2 + len);
}
}