From 50718adc3254e913285b9f11557b0e585fbe9120 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Fri, 10 Sep 2021 08:30:46 +0200 Subject: [PATCH] make bytes in InnerHeaderField non-nullable. --- lib/src/kdbx_binary.dart | 4 ++-- lib/src/kdbx_header.dart | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/kdbx_binary.dart b/lib/src/kdbx_binary.dart index ae33987..d8fe795 100644 --- a/lib/src/kdbx_binary.dart +++ b/lib/src/kdbx_binary.dart @@ -20,9 +20,9 @@ class KdbxBinary { int? _valueHashCode; static KdbxBinary readBinaryInnerHeader(InnerHeaderField field) { - final flags = field.bytes![0]; + final flags = field.bytes[0]; final isProtected = flags & 0x01 == 0x01; - final value = Uint8List.sublistView(field.bytes!, 1); + final value = Uint8List.sublistView(field.bytes, 1); return KdbxBinary( isInline: false, isProtected: isProtected, diff --git a/lib/src/kdbx_header.dart b/lib/src/kdbx_header.dart index 46f39f1..804394e 100644 --- a/lib/src/kdbx_header.dart +++ b/lib/src/kdbx_header.dart @@ -145,7 +145,7 @@ class InnerHeaderField implements HeaderFieldBase { @override final InnerHeaderFields field; - final Uint8List? bytes; + final Uint8List bytes; String get name => field.toString(); } @@ -323,10 +323,10 @@ class KdbxHeader { void _writeInnerField(WriterHelper writer, InnerHeaderField value) { final field = value.field; _logger.finer( - 'Writing header $field (${field.index}) (${value.bytes!.lengthInBytes})'); + 'Writing header $field (${field.index}) (${value.bytes.lengthInBytes})'); writer.writeUint8(field.index); - _writeFieldSize(writer, value.bytes!.lengthInBytes); - writer.writeBytes(value.bytes!); + _writeFieldSize(writer, value.bytes.lengthInBytes); + writer.writeBytes(value.bytes); } void _writeField(WriterHelper writer, HeaderFields field) {