From b24b601a9a47005690c145511acde1e771fef7b9 Mon Sep 17 00:00:00 2001 From: luckyrat Date: Tue, 20 Feb 2024 20:04:51 +0000 Subject: [PATCH] wip --- bin/kdbx.dart | 3 +- lib/src/crypto/protected_salt_generator.dart | 2 +- lib/src/crypto/protected_value.dart | 2 +- lib/src/kdbx_custom_data.dart | 8 ++-- lib/src/kdbx_deleted_object.dart | 3 +- lib/src/kdbx_entry.dart | 4 +- lib/src/kdbx_format.dart | 4 +- lib/src/kdbx_meta.dart | 4 +- lib/src/kdbx_times.dart | 3 +- lib/src/kdbx_xml.dart | 20 ++++---- .../browser_entry_settings_v1.dart | 4 +- lib/src/kee_vault_model/entry_matcher.dart | 32 ++++++------- .../kee_vault_model/entry_matcher_config.dart | 48 +++++++++---------- lib/src/kee_vault_model/field.dart | 48 +++++++++---------- lib/src/kee_vault_model/field_matcher.dart | 46 +++++++++--------- .../kee_vault_model/field_matcher_config.dart | 40 ++++++++-------- lib/src/utils/byte_utils.dart | 4 +- lib/src/utils/guid_service.dart | 2 +- lib/src/utils/scope_functions.dart | 1 + 19 files changed, 139 insertions(+), 139 deletions(-) diff --git a/bin/kdbx.dart b/bin/kdbx.dart index 97d26d8..67fe04b 100644 --- a/bin/kdbx.dart +++ b/bin/kdbx.dart @@ -33,8 +33,7 @@ void main(List arguments) { } class KdbxCommandRunner extends CommandRunner { - KdbxCommandRunner(String executableName, String description) - : super(executableName, description) { + KdbxCommandRunner(super.executableName, super.description) { argParser.addFlag('verbose', abbr: 'v'); addCommand(CatCommand()); addCommand(DumpXmlCommand()); diff --git a/lib/src/crypto/protected_salt_generator.dart b/lib/src/crypto/protected_salt_generator.dart index d108dcf..ccea8e3 100644 --- a/lib/src/crypto/protected_salt_generator.dart +++ b/lib/src/crypto/protected_salt_generator.dart @@ -42,7 +42,7 @@ class ProtectedSaltGenerator { } class ChachaProtectedSaltGenerator extends ProtectedSaltGenerator { - ChachaProtectedSaltGenerator._(StreamCipher state) : super._(state); + ChachaProtectedSaltGenerator._(super.state) : super._(); factory ChachaProtectedSaltGenerator.create(Uint8List key) { final hash = sha512.convert(key); diff --git a/lib/src/crypto/protected_value.dart b/lib/src/crypto/protected_value.dart index dc12aba..747a2d7 100644 --- a/lib/src/crypto/protected_value.dart +++ b/lib/src/crypto/protected_value.dart @@ -30,7 +30,7 @@ class PlainValue implements StringValue { } class ProtectedValue extends PlainValue { - ProtectedValue(String text) : super(text); + ProtectedValue(super.text); factory ProtectedValue.fromString(String value) { return ProtectedValue(value); diff --git a/lib/src/kdbx_custom_data.dart b/lib/src/kdbx_custom_data.dart index eb7dd0c..7c06908 100644 --- a/lib/src/kdbx_custom_data.dart +++ b/lib/src/kdbx_custom_data.dart @@ -8,14 +8,14 @@ class KdbxObjectCustomData extends KdbxNode { : _data = {}, super.create(KdbxXml.NODE_CUSTOM_DATA); - KdbxObjectCustomData.read(xml.XmlElement node) + KdbxObjectCustomData.read(super.node) : _data = Map.fromEntries( node.findElements(KdbxXml.NODE_CUSTOM_DATA_ITEM).map((el) { final key = el.singleTextNode(KdbxXml.NODE_KEY); final value = el.singleTextNode(KdbxXml.NODE_VALUE); return MapEntry(key, value); })), - super.read(node); + super.read(); final Map _data; @@ -59,7 +59,7 @@ class KdbxMetaCustomData extends KdbxNode { : _data = {}, super.create(KdbxXml.NODE_CUSTOM_DATA); - KdbxMetaCustomData.read(xml.XmlElement node) + KdbxMetaCustomData.read(super.node) : _data = Map.fromEntries( node.findElements(KdbxXml.NODE_CUSTOM_DATA_ITEM).map((el) { final key = el.singleTextNode(KdbxXml.NODE_KEY); @@ -73,7 +73,7 @@ class KdbxMetaCustomData extends KdbxNode { : null )); })), - super.read(node); + super.read(); final Map _data; diff --git a/lib/src/kdbx_deleted_object.dart b/lib/src/kdbx_deleted_object.dart index d100f82..050d536 100644 --- a/lib/src/kdbx_deleted_object.dart +++ b/lib/src/kdbx_deleted_object.dart @@ -2,7 +2,6 @@ import 'package:clock/clock.dart'; import 'package:kdbx/src/kdbx_format.dart'; import 'package:kdbx/src/kdbx_object.dart'; import 'package:kdbx/src/kdbx_xml.dart'; -import 'package:xml/xml.dart'; class KdbxDeletedObject extends KdbxNode implements KdbxNodeContext { KdbxDeletedObject.create(this.ctx, KdbxUuid uuid, {DateTime? deletionTime}) @@ -11,7 +10,7 @@ class KdbxDeletedObject extends KdbxNode implements KdbxNodeContext { this.deletionTime.set(deletionTime ?? clock.now().toUtc()); } - KdbxDeletedObject.read(XmlElement node, this.ctx) : super.read(node); + KdbxDeletedObject.read(super.node, this.ctx) : super.read(); static const NODE_NAME = KdbxXml.NODE_DELETED_OBJECT; diff --git a/lib/src/kdbx_entry.dart b/lib/src/kdbx_entry.dart index c2a451a..c5b7bdf 100644 --- a/lib/src/kdbx_entry.dart +++ b/lib/src/kdbx_entry.dart @@ -1,17 +1,19 @@ import 'dart:collection'; import 'dart:convert'; import 'dart:typed_data'; + import 'package:collection/collection.dart'; -import 'package:kdbx/src/kee_vault_model/browser_entry_settings_v1.dart'; import 'package:kdbx/src/internal/extension_utils.dart'; import 'package:kdbx/src/kdbx_format.dart'; import 'package:kdbx/src/kdbx_object.dart'; import 'package:kdbx/src/kdbx_xml.dart'; +import 'package:kdbx/src/kee_vault_model/browser_entry_settings_v1.dart'; import 'package:kdbx/src/utils/guid_service.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as path; import 'package:quiver/check.dart'; import 'package:xml/xml.dart'; + import '../kdbx.dart'; final _logger = Logger('kdbx.kdbx_entry'); diff --git a/lib/src/kdbx_format.dart b/lib/src/kdbx_format.dart index edc0c45..d9f6e5c 100644 --- a/lib/src/kdbx_format.dart +++ b/lib/src/kdbx_format.dart @@ -133,10 +133,10 @@ class KdbxBody extends KdbxNode { } KdbxBody.read( - xml.XmlElement node, + super.node, this.meta, this.rootGroup, - ) : super.read(node); + ) : super.read(); // final xml.XmlDocument xmlDocument; final KdbxMeta meta; diff --git a/lib/src/kdbx_meta.dart b/lib/src/kdbx_meta.dart index c39123d..28d2525 100644 --- a/lib/src/kdbx_meta.dart +++ b/lib/src/kdbx_meta.dart @@ -40,7 +40,7 @@ class KdbxMeta extends KdbxNode implements KdbxNodeContext { historyMaxSize.set(Consts.DefaultHistoryMaxSize); } - KdbxMeta.read(xml.XmlElement node, this.ctx) + KdbxMeta.read(super.node, this.ctx) : customData = node .singleElement(KdbxXml.NODE_CUSTOM_DATA) ?.let((e) => KdbxMetaCustomData.read(e)) ?? @@ -91,7 +91,7 @@ class KdbxMeta extends KdbxNode implements KdbxNodeContext { .map((e) => MapEntry(e.uuid, e)) .let((that) => Map.fromEntries(that)) ?? {}, - super.read(node); + super.read(); @override final KdbxReadWriteContext ctx; diff --git a/lib/src/kdbx_times.dart b/lib/src/kdbx_times.dart index b1094b1..5acb1f6 100644 --- a/lib/src/kdbx_times.dart +++ b/lib/src/kdbx_times.dart @@ -4,7 +4,6 @@ import 'package:kdbx/src/kdbx_object.dart'; import 'package:kdbx/src/kdbx_xml.dart'; import 'package:logging/logging.dart'; import 'package:quiver/iterables.dart'; -import 'package:xml/xml.dart'; final _logger = Logger('kdbx_times'); @@ -19,7 +18,7 @@ class KdbxTimes extends KdbxNode implements KdbxNodeContext { usageCount.set(0); locationChanged.set(now); } - KdbxTimes.read(XmlElement node, this.ctx) : super.read(node) { + KdbxTimes.read(super.node, this.ctx) : super.read() { // backward compatibility - there was a bug setting/reading // modification, lastAccess and expiryTime. Make sure they are defined. final checkDates = { diff --git a/lib/src/kdbx_xml.dart b/lib/src/kdbx_xml.dart index 2a6fb5f..33e5c49 100644 --- a/lib/src/kdbx_xml.dart +++ b/lib/src/kdbx_xml.dart @@ -92,7 +92,7 @@ extension on List { } abstract class KdbxSubTextNode extends KdbxSubNode { - KdbxSubTextNode(KdbxNode node, String name) : super(node, name); + KdbxSubTextNode(super.node, super.name); void Function()? _onModify; @@ -158,7 +158,7 @@ abstract class KdbxSubTextNode extends KdbxSubNode { } class IntNode extends KdbxSubTextNode { - IntNode(KdbxNode node, String name) : super(node, name); + IntNode(super.node, super.name); @override int? decode(String value) => int.tryParse(value); @@ -168,7 +168,7 @@ class IntNode extends KdbxSubTextNode { } class StringNode extends KdbxSubTextNode { - StringNode(KdbxNode node, String name) : super(node, name); + StringNode(super.node, super.name); @override String decode(String value) => value; @@ -178,7 +178,7 @@ class StringNode extends KdbxSubTextNode { } class StringListNode extends KdbxSubTextNode> { - StringListNode(KdbxNode node, String name) : super(node, name); + StringListNode(super.node, super.name); @override List decode(String value) { @@ -195,7 +195,7 @@ class StringListNode extends KdbxSubTextNode> { } class Base64Node extends KdbxSubTextNode { - Base64Node(KdbxNode node, String name) : super(node, name); + Base64Node(super.node, super.name); @override ByteBuffer decode(String value) => base64.decode(value).buffer; @@ -205,7 +205,7 @@ class Base64Node extends KdbxSubTextNode { } class UuidNode extends KdbxSubTextNode { - UuidNode(KdbxNode node, String name) : super(node, name); + UuidNode(super.node, super.name); @override KdbxUuid decode(String value) => KdbxUuid(value); @@ -215,7 +215,7 @@ class UuidNode extends KdbxSubTextNode { } class IconNode extends KdbxSubTextNode { - IconNode(KdbxNode node, String name) : super(node, name); + IconNode(super.node, super.name); @override KdbxIcon decode(String value) => KdbxIcon.values[int.tryParse(value) ?? 0]; @@ -243,7 +243,7 @@ class KdbxColor { // Tolerates 6 digit hex strings but outputs more-compatible 7 char strings with leading # class ColorNode extends KdbxSubTextNode { - ColorNode(KdbxNode node, String name) : super(node, name); + ColorNode(super.node, super.name); @override KdbxColor decode(String value) => KdbxColor.parse(value); @@ -253,7 +253,7 @@ class ColorNode extends KdbxSubTextNode { } class NullableBooleanNode extends KdbxSubTextNode { - NullableBooleanNode(KdbxNode node, String name) : super(node, name); + NullableBooleanNode(super.node, super.name); @override bool? decode(String value) { @@ -284,7 +284,7 @@ class NullableBooleanNode extends KdbxSubTextNode { } class DateTimeUtcNode extends KdbxSubTextNode { - DateTimeUtcNode(KdbxNodeContext node, String name) : super(node, name); + DateTimeUtcNode(KdbxNodeContext super.node, super.name); KdbxReadWriteContext get _ctx => (node as KdbxNodeContext).ctx; static final minDate = DateTime.fromMillisecondsSinceEpoch(0, isUtc: true); diff --git a/lib/src/kee_vault_model/browser_entry_settings_v1.dart b/lib/src/kee_vault_model/browser_entry_settings_v1.dart index 53451d5..d15be94 100644 --- a/lib/src/kee_vault_model/browser_entry_settings_v1.dart +++ b/lib/src/kee_vault_model/browser_entry_settings_v1.dart @@ -326,7 +326,7 @@ class BrowserEntrySettingsV1 { final List fields = []; bool usernameFound = false; bool passwordFound = false; - formFieldList.forEach((ff) { + for (final ff in formFieldList) { if (ff.value == '{USERNAME}') { usernameFound = true; final mc = !((ff.fieldId?.isNotEmpty ?? false) || @@ -393,7 +393,7 @@ class BrowserEntrySettingsV1 { } fields.add(f); } - }); + } if (!usernameFound) { fields.add(Field( diff --git a/lib/src/kee_vault_model/entry_matcher.dart b/lib/src/kee_vault_model/entry_matcher.dart index 6a7f5fe..1541968 100644 --- a/lib/src/kee_vault_model/entry_matcher.dart +++ b/lib/src/kee_vault_model/entry_matcher.dart @@ -9,6 +9,22 @@ class EntryMatcher { this.pageTitles = const [], }); + factory EntryMatcher.fromMap(Map? map) { + if (map == null) { + return EntryMatcher(); + } + + return EntryMatcher( + matchLogic: MatcherLogic.values + .firstWhereOrNull((v) => v.name == map['matchLogic']), + queries: (map['queries'] as List?)?.cast() ?? [], + pageTitles: (map['pageTitles'] as List?)?.cast() ?? [], + ); + } + + factory EntryMatcher.fromJson(String source) => + EntryMatcher.fromMap(json.decode(source) as Map?); + EntryMatcher copyWith({ MatcherLogic? matchLogic, List? queries, @@ -29,24 +45,8 @@ class EntryMatcher { }; } - factory EntryMatcher.fromMap(Map? map) { - if (map == null) { - return EntryMatcher(); - } - - return EntryMatcher( - matchLogic: MatcherLogic.values - .firstWhereOrNull((v) => v.name == map['matchLogic']), - queries: (map['queries'] as List?)?.cast() ?? [], - pageTitles: (map['pageTitles'] as List?)?.cast() ?? [], - ); - } - String toJson() => json.encode(toMap()); - factory EntryMatcher.fromJson(String source) => - EntryMatcher.fromMap(json.decode(source) as Map?); - @override bool operator ==(Object other) { if (identical(this, other)) return true; diff --git a/lib/src/kee_vault_model/entry_matcher_config.dart b/lib/src/kee_vault_model/entry_matcher_config.dart index a0b9220..2f75246 100644 --- a/lib/src/kee_vault_model/entry_matcher_config.dart +++ b/lib/src/kee_vault_model/entry_matcher_config.dart @@ -14,6 +14,30 @@ class EntryMatcherConfig { this.actionOnNoMatch, }); + factory EntryMatcherConfig.fromMap(Map? map) { + if (map == null) { + return EntryMatcherConfig(); + } + + return EntryMatcherConfig( + matcherType: EntryMatcherType.values + .firstWhereOrNull((v) => v.name == map['matcherType']), + customMatcher: map['customMatcher'] != null + ? EntryMatcher.fromMap(map['customMatcher'] as Map) + : null, + urlMatchMethod: MatchAccuracy.values + .firstWhereOrNull((v) => v.name == map['urlMatchMethod']), + weight: map['weight'] as int?, + actionOnMatch: MatchAction.values + .firstWhereOrNull((v) => v.name == map['actionOnMatch']), + actionOnNoMatch: MatchAction.values + .firstWhereOrNull((v) => v.name == map['actionOnNoMatch']), + ); + } + + factory EntryMatcherConfig.fromJson(String source) => + EntryMatcherConfig.fromMap(json.decode(source) as Map); + EntryMatcherConfig.forDefaultUrlMatchBehaviour(MatchAccuracy ma) : this( matcherType: EntryMatcherType.Url, @@ -50,32 +74,8 @@ class EntryMatcherConfig { }; } - factory EntryMatcherConfig.fromMap(Map? map) { - if (map == null) { - return EntryMatcherConfig(); - } - - return EntryMatcherConfig( - matcherType: EntryMatcherType.values - .firstWhereOrNull((v) => v.name == map['matcherType']), - customMatcher: map['customMatcher'] != null - ? EntryMatcher.fromMap(map['customMatcher'] as Map) - : null, - urlMatchMethod: MatchAccuracy.values - .firstWhereOrNull((v) => v.name == map['urlMatchMethod']), - weight: map['weight'] as int?, - actionOnMatch: MatchAction.values - .firstWhereOrNull((v) => v.name == map['actionOnMatch']), - actionOnNoMatch: MatchAction.values - .firstWhereOrNull((v) => v.name == map['actionOnNoMatch']), - ); - } - String toJson() => json.encode(toMap()); - factory EntryMatcherConfig.fromJson(String source) => - EntryMatcherConfig.fromMap(json.decode(source) as Map); - @override String toString() { return 'EntryMatcherConfig(matcherType: $matcherType, customMatcher: $customMatcher, urlMatchMethod: $urlMatchMethod, weight: $weight, actionOnMatch: $actionOnMatch, actionOnNoMatch: $actionOnNoMatch)'; diff --git a/lib/src/kee_vault_model/field.dart b/lib/src/kee_vault_model/field.dart index c99f0c3..399a936 100644 --- a/lib/src/kee_vault_model/field.dart +++ b/lib/src/kee_vault_model/field.dart @@ -18,6 +18,30 @@ class Field { this.matcherConfigs, }); + factory Field.fromMap(Map? map) { + if (map == null) { + return Field(); + } + return Field( + uuid: map['uuid'] as String?, + name: map['name'] as String?, + valuePath: map['valuePath'] as String?, + value: map['value'] as String?, + page: map['page'] as int? ?? 1, + type: FieldType.values.firstWhereOrNull((v) => v.name == map['type']), + placeholderHandling: PlaceholderHandling.values + .firstWhereOrNull((v) => v.name == map['placeholderHandling']), + matcherConfigs: List.from((map['matcherConfigs'] + as List?) + ?.cast>() + .map((x) => FieldMatcherConfig.fromMap(x)) ?? + []), + ); + } + + factory Field.fromJson(String source) => + Field.fromMap(json.decode(source) as Map?); + Field copyWith({ String? uuid, String? name, @@ -55,32 +79,8 @@ class Field { }; } - factory Field.fromMap(Map? map) { - if (map == null) { - return Field(); - } - return Field( - uuid: map['uuid'] as String?, - name: map['name'] as String?, - valuePath: map['valuePath'] as String?, - value: map['value'] as String?, - page: map['page'] as int? ?? 1, - type: FieldType.values.firstWhereOrNull((v) => v.name == map['type']), - placeholderHandling: PlaceholderHandling.values - .firstWhereOrNull((v) => v.name == map['placeholderHandling']), - matcherConfigs: List.from((map['matcherConfigs'] - as List?) - ?.cast>() - .map((x) => FieldMatcherConfig.fromMap(x)) ?? - []), - ); - } - String toJson() => json.encode(toMap()); - factory Field.fromJson(String source) => - Field.fromMap(json.decode(source) as Map?); - @override String toString() { return 'Field(uuid: $uuid, name: $name, valuePath: $valuePath, value: $value, page: $page, type: $type, placeholderHandling: $placeholderHandling, matcherConfigs: $matcherConfigs)'; diff --git a/lib/src/kee_vault_model/field_matcher.dart b/lib/src/kee_vault_model/field_matcher.dart index 8186688..b165696 100644 --- a/lib/src/kee_vault_model/field_matcher.dart +++ b/lib/src/kee_vault_model/field_matcher.dart @@ -15,6 +15,29 @@ class FieldMatcher { this.minLength, }); + factory FieldMatcher.fromMap(Map? map) { + if (map == null) { + return FieldMatcher(); + } + + return FieldMatcher( + matchLogic: MatcherLogic.values + .firstWhereOrNull((v) => v.name == map['matchLogic']), + ids: (map['ids'] as List?)?.cast() ?? [], + names: (map['names'] as List?)?.cast() ?? [], + types: (map['types'] as List?)?.cast() ?? [], + queries: (map['queries'] as List?)?.cast() ?? [], + labels: (map['labels'] as List?)?.cast() ?? [], + autocompleteValues: + (map['autocompleteValues'] as List?)?.cast() ?? [], + maxLength: map['maxLength'] as int?, + minLength: map['minLength'] as int?, + ); + } + + factory FieldMatcher.fromJson(String source) => + FieldMatcher.fromMap(json.decode(source) as Map?); + FieldMatcher copyWith({ MatcherLogic? matchLogic, List? ids, @@ -55,31 +78,8 @@ class FieldMatcher { }; } - factory FieldMatcher.fromMap(Map? map) { - if (map == null) { - return FieldMatcher(); - } - - return FieldMatcher( - matchLogic: MatcherLogic.values - .firstWhereOrNull((v) => v.name == map['matchLogic']), - ids: (map['ids'] as List?)?.cast() ?? [], - names: (map['names'] as List?)?.cast() ?? [], - types: (map['types'] as List?)?.cast() ?? [], - queries: (map['queries'] as List?)?.cast() ?? [], - labels: (map['labels'] as List?)?.cast() ?? [], - autocompleteValues: - (map['autocompleteValues'] as List?)?.cast() ?? [], - maxLength: map['maxLength'] as int?, - minLength: map['minLength'] as int?, - ); - } - String toJson() => json.encode(toMap()); - factory FieldMatcher.fromJson(String source) => - FieldMatcher.fromMap(json.decode(source) as Map?); - @override String toString() { return 'FieldMatcher(matchLogic: $matchLogic, ids: $ids, names: $names, types: $types, queries: $queries, labels: $labels, autocompleteValues: $autocompleteValues, maxLength: $maxLength, minLength: $minLength)'; diff --git a/lib/src/kee_vault_model/field_matcher_config.dart b/lib/src/kee_vault_model/field_matcher_config.dart index ddb36cb..3a919b2 100644 --- a/lib/src/kee_vault_model/field_matcher_config.dart +++ b/lib/src/kee_vault_model/field_matcher_config.dart @@ -13,6 +13,26 @@ class FieldMatcherConfig { this.actionOnMatch, }); + factory FieldMatcherConfig.fromMap(Map? map) { + if (map == null) { + return FieldMatcherConfig(); + } + + return FieldMatcherConfig( + matcherType: FieldMatcherType.values + .firstWhereOrNull((v) => v.name == map['matchLogic']), + customMatcher: map['customMatcher'] != null + ? FieldMatcher.fromMap(map['customMatcher'] as Map) + : null, + weight: map['weight'] as int?, + actionOnMatch: MatchAction.values + .firstWhereOrNull((v) => v.name == map['actionOnMatch']), + ); + } + + factory FieldMatcherConfig.fromJson(String source) => + FieldMatcherConfig.fromMap(json.decode(source) as Map?); + FieldMatcherConfig.forSingleClientMatch( String fft, { String? id, @@ -64,28 +84,8 @@ class FieldMatcherConfig { }; } - factory FieldMatcherConfig.fromMap(Map? map) { - if (map == null) { - return FieldMatcherConfig(); - } - - return FieldMatcherConfig( - matcherType: FieldMatcherType.values - .firstWhereOrNull((v) => v.name == map['matchLogic']), - customMatcher: map['customMatcher'] != null - ? FieldMatcher.fromMap(map['customMatcher'] as Map) - : null, - weight: map['weight'] as int?, - actionOnMatch: MatchAction.values - .firstWhereOrNull((v) => v.name == map['actionOnMatch']), - ); - } - String toJson() => json.encode(toMap()); - factory FieldMatcherConfig.fromJson(String source) => - FieldMatcherConfig.fromMap(json.decode(source) as Map?); - @override String toString() { return 'FieldMatcherConfig(matcherType: $matcherType, customMatcher: $customMatcher, weight: $weight, actionOnMatch: $actionOnMatch)'; diff --git a/lib/src/utils/byte_utils.dart b/lib/src/utils/byte_utils.dart index 9fa7c4a..589beff 100644 --- a/lib/src/utils/byte_utils.dart +++ b/lib/src/utils/byte_utils.dart @@ -105,7 +105,7 @@ class ReaderHelper { } class ReaderHelperDartWeb extends ReaderHelper { - ReaderHelperDartWeb(Uint8List byteData) : super._(byteData); + ReaderHelperDartWeb(super.byteData) : super._(); @override int readUint64() { @@ -184,7 +184,7 @@ class WriterHelper { } class WriterHelperDartWeb extends WriterHelper { - WriterHelperDartWeb([BytesBuilder? output]) : super._(output); + WriterHelperDartWeb([super.output]) : super._(); @override void writeUint64(int value, [LengthWriter? lengthWriter]) { diff --git a/lib/src/utils/guid_service.dart b/lib/src/utils/guid_service.dart index 3af3c92..4e54d6d 100644 --- a/lib/src/utils/guid_service.dart +++ b/lib/src/utils/guid_service.dart @@ -7,6 +7,6 @@ abstract class IGuidService { class GuidService implements IGuidService { @override String newGuid() { - return Uuid().v4(); + return const Uuid().v4(); } } diff --git a/lib/src/utils/scope_functions.dart b/lib/src/utils/scope_functions.dart index a18fa5c..37ef4bc 100644 --- a/lib/src/utils/scope_functions.dart +++ b/lib/src/utils/scope_functions.dart @@ -1,5 +1,6 @@ /// https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/lib/scope_functions.dart /// MIT license: https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/LICENSE +library; ReturnType run(ReturnType Function() operation) { return operation();