From e7387221895cf2c2dc50de80306999d79442ad96 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Sun, 10 May 2020 23:41:51 +0200 Subject: [PATCH] fix a couple of analyzer warnings. --- lib/src/internal/async_utils.dart | 2 +- lib/src/internal/byte_utils.dart | 2 +- lib/src/internal/crypto_utils.dart | 2 ++ lib/src/kdbx_dao.dart | 3 --- lib/src/kdbx_times.dart | 1 + lib/src/utils/scope_functions.dart | 6 +++--- test/internal/test_utils.dart | 2 ++ 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/src/internal/async_utils.dart b/lib/src/internal/async_utils.dart index a6d58d8..19c6650 100644 --- a/lib/src/internal/async_utils.dart +++ b/lib/src/internal/async_utils.dart @@ -7,7 +7,7 @@ mixin StreamSubscriberBase { >[]; /// Listens to a stream and saves it to the list of subscriptions. - void listen(Stream stream, void onData(dynamic data), + void listen(Stream stream, void Function(dynamic data) onData, {Function onError}) { if (stream != null) { _subscriptions.add(stream.listen(onData, onError: onError)); diff --git a/lib/src/internal/byte_utils.dart b/lib/src/internal/byte_utils.dart index 74d6842..5ae1966 100644 --- a/lib/src/internal/byte_utils.dart +++ b/lib/src/internal/byte_utils.dart @@ -13,7 +13,7 @@ class ByteUtils { if (a.length != b.length) { return false; } - for (int i = a.length - 1; i >= 0; i--) { + for (var i = a.length - 1; i >= 0; i--) { if (a[i] != b[i]) { return false; } diff --git a/lib/src/internal/crypto_utils.dart b/lib/src/internal/crypto_utils.dart index b43d20c..6923120 100644 --- a/lib/src/internal/crypto_utils.dart +++ b/lib/src/internal/crypto_utils.dart @@ -2,6 +2,8 @@ import 'dart:typed_data'; import 'package:pointycastle/export.dart'; +// ignore_for_file: omit_local_variable_types + /// https://gist.github.com/proteye/e54eef1713e1fe9123d1eb04c0a5cf9b class AesHelper { static const CBC_MODE = 'CBC'; diff --git a/lib/src/kdbx_dao.dart b/lib/src/kdbx_dao.dart index 46c0f06..2868273 100644 --- a/lib/src/kdbx_dao.dart +++ b/lib/src/kdbx_dao.dart @@ -1,10 +1,7 @@ import 'package:kdbx/kdbx.dart'; import 'package:kdbx/src/kdbx_file.dart'; -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; -final _logger = Logger('kdbx_dao'); - /// Helper object for accessing and modifing data inside /// a kdbx file. extension KdbxDao on KdbxFile { diff --git a/lib/src/kdbx_times.dart b/lib/src/kdbx_times.dart index f5ce711..8a13e97 100644 --- a/lib/src/kdbx_times.dart +++ b/lib/src/kdbx_times.dart @@ -17,6 +17,7 @@ class KdbxTimes extends KdbxNode implements KdbxNodeContext { } KdbxTimes.read(XmlElement node, this.ctx) : super.read(node); + @override final KdbxReadWriteContext ctx; DateTimeUtcNode get creationTime => DateTimeUtcNode(this, 'CreationTime'); diff --git a/lib/src/utils/scope_functions.dart b/lib/src/utils/scope_functions.dart index 44f8089..a18fa5c 100644 --- a/lib/src/utils/scope_functions.dart +++ b/lib/src/utils/scope_functions.dart @@ -1,16 +1,16 @@ /// 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 -ReturnType run(ReturnType operation()) { +ReturnType run(ReturnType Function() operation) { return operation(); } extension ScopeFunctionsForObject on T { - ReturnType let(ReturnType operationFor(T self)) { + ReturnType let(ReturnType Function(T self) operationFor) { return operationFor(this); } - T also(void operationFor(T self)) { + T also(void Function(T self) operationFor) { operationFor(this); return this; } diff --git a/test/internal/test_utils.dart b/test/internal/test_utils.dart index 8d788e4..ec075a7 100644 --- a/test/internal/test_utils.dart +++ b/test/internal/test_utils.dart @@ -6,6 +6,8 @@ import 'dart:typed_data'; import 'package:ffi/ffi.dart'; import 'package:kdbx/kdbx.dart'; +// ignore_for_file: non_constant_identifier_names + typedef Argon2HashNative = Pointer Function( Pointer key, IntPtr keyLen,