Browse Source

Fix compilation casting

pull/5/head
Mattia Natali 2 years ago
parent
commit
842ae06ae8
No known key found for this signature in database
GPG Key ID: 5AFCF434660B96DF
  1. 14
      lib/src/kdbx_var_dictionary.dart

14
lib/src/kdbx_var_dictionary.dart

@ -20,37 +20,37 @@ class ValueType<T> {
final Decoder<T> decoder; final Decoder<T> decoder;
final Encoder<T>? encoder; final Encoder<T>? encoder;
static final typeUInt32 = ValueType( static final typeUInt32 = ValueType<int>(
0x04, 0x04,
(reader, _) => reader.readUint32(), (reader, _) => reader.readUint32(),
(writer, value) => writer.writeUint32(value, writer._lengthWriter()), (writer, value) => writer.writeUint32(value, writer._lengthWriter()),
); );
static final typeUInt64 = ValueType( static final typeUInt64 = ValueType<int>(
0x05, 0x05,
(reader, _) => reader.readUint64(), (reader, _) => reader.readUint64(),
(writer, value) => writer.writeUint64(value, writer._lengthWriter()), (writer, value) => writer.writeUint64(value, writer._lengthWriter()),
); );
static final typeBool = ValueType( static final typeBool = ValueType<bool>(
0x08, 0x08,
(reader, _) => reader.readUint8() != 0, (reader, _) => reader.readUint8() != 0,
(writer, value) => writer.writeUint8(value ? 1 : 0, writer._lengthWriter()), (writer, value) => writer.writeUint8(value ? 1 : 0, writer._lengthWriter()),
); );
static final typeInt32 = ValueType( static final typeInt32 = ValueType<int>(
0x0C, 0x0C,
(reader, _) => reader.readInt32(), (reader, _) => reader.readInt32(),
(writer, value) => writer.writeInt32(value, writer._lengthWriter()), (writer, value) => writer.writeInt32(value, writer._lengthWriter()),
); );
static final typeInt64 = ValueType( static final typeInt64 = ValueType<int>(
0x0D, 0x0D,
(reader, _) => reader.readInt64(), (reader, _) => reader.readInt64(),
(writer, value) => writer.writeInt64(value, writer._lengthWriter()), (writer, value) => writer.writeInt64(value, writer._lengthWriter()),
); );
static final typeString = ValueType( static final typeString = ValueType<String>(
0x18, 0x18,
(reader, length) => reader.readString(length), (reader, length) => reader.readString(length),
(writer, value) => writer.writeString(value, writer._lengthWriter()), (writer, value) => writer.writeString(value, writer._lengthWriter()),
); );
static final typeBytes = ValueType( static final typeBytes = ValueType<Uint8List>(
0x42, 0x42,
(reader, length) => reader.readBytes(length), (reader, length) => reader.readBytes(length),
(writer, value) => writer.writeBytes(value, writer._lengthWriter()), (writer, value) => writer.writeBytes(value, writer._lengthWriter()),

Loading…
Cancel
Save