Browse Source

fix a couple of analyzer warnings.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
e738722189
  1. 2
      lib/src/internal/async_utils.dart
  2. 2
      lib/src/internal/byte_utils.dart
  3. 2
      lib/src/internal/crypto_utils.dart
  4. 3
      lib/src/kdbx_dao.dart
  5. 1
      lib/src/kdbx_times.dart
  6. 6
      lib/src/utils/scope_functions.dart
  7. 2
      test/internal/test_utils.dart

2
lib/src/internal/async_utils.dart

@ -7,7 +7,7 @@ mixin StreamSubscriberBase {
<StreamSubscription<dynamic>>[]; <StreamSubscription<dynamic>>[];
/// Listens to a stream and saves it to the list of subscriptions. /// Listens to a stream and saves it to the list of subscriptions.
void listen(Stream<dynamic> stream, void onData(dynamic data), void listen(Stream<dynamic> stream, void Function(dynamic data) onData,
{Function onError}) { {Function onError}) {
if (stream != null) { if (stream != null) {
_subscriptions.add(stream.listen(onData, onError: onError)); _subscriptions.add(stream.listen(onData, onError: onError));

2
lib/src/internal/byte_utils.dart

@ -13,7 +13,7 @@ class ByteUtils {
if (a.length != b.length) { if (a.length != b.length) {
return false; 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]) { if (a[i] != b[i]) {
return false; return false;
} }

2
lib/src/internal/crypto_utils.dart

@ -2,6 +2,8 @@ import 'dart:typed_data';
import 'package:pointycastle/export.dart'; import 'package:pointycastle/export.dart';
// ignore_for_file: omit_local_variable_types
/// https://gist.github.com/proteye/e54eef1713e1fe9123d1eb04c0a5cf9b /// https://gist.github.com/proteye/e54eef1713e1fe9123d1eb04c0a5cf9b
class AesHelper { class AesHelper {
static const CBC_MODE = 'CBC'; static const CBC_MODE = 'CBC';

3
lib/src/kdbx_dao.dart

@ -1,10 +1,7 @@
import 'package:kdbx/kdbx.dart'; import 'package:kdbx/kdbx.dart';
import 'package:kdbx/src/kdbx_file.dart'; import 'package:kdbx/src/kdbx_file.dart';
import 'package:logging/logging.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
final _logger = Logger('kdbx_dao');
/// Helper object for accessing and modifing data inside /// Helper object for accessing and modifing data inside
/// a kdbx file. /// a kdbx file.
extension KdbxDao on KdbxFile { extension KdbxDao on KdbxFile {

1
lib/src/kdbx_times.dart

@ -17,6 +17,7 @@ class KdbxTimes extends KdbxNode implements KdbxNodeContext {
} }
KdbxTimes.read(XmlElement node, this.ctx) : super.read(node); KdbxTimes.read(XmlElement node, this.ctx) : super.read(node);
@override
final KdbxReadWriteContext ctx; final KdbxReadWriteContext ctx;
DateTimeUtcNode get creationTime => DateTimeUtcNode(this, 'CreationTime'); DateTimeUtcNode get creationTime => DateTimeUtcNode(this, 'CreationTime');

6
lib/src/utils/scope_functions.dart

@ -1,16 +1,16 @@
/// https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/lib/scope_functions.dart /// 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 /// MIT license: https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/LICENSE
ReturnType run<ReturnType>(ReturnType operation()) { ReturnType run<ReturnType>(ReturnType Function() operation) {
return operation(); return operation();
} }
extension ScopeFunctionsForObject<T extends Object> on T { extension ScopeFunctionsForObject<T extends Object> on T {
ReturnType let<ReturnType>(ReturnType operationFor(T self)) { ReturnType let<ReturnType>(ReturnType Function(T self) operationFor) {
return operationFor(this); return operationFor(this);
} }
T also(void operationFor(T self)) { T also(void Function(T self) operationFor) {
operationFor(this); operationFor(this);
return this; return this;
} }

2
test/internal/test_utils.dart

@ -6,6 +6,8 @@ import 'dart:typed_data';
import 'package:ffi/ffi.dart'; import 'package:ffi/ffi.dart';
import 'package:kdbx/kdbx.dart'; import 'package:kdbx/kdbx.dart';
// ignore_for_file: non_constant_identifier_names
typedef Argon2HashNative = Pointer<Utf8> Function( typedef Argon2HashNative = Pointer<Utf8> Function(
Pointer<Uint8> key, Pointer<Uint8> key,
IntPtr keyLen, IntPtr keyLen,

Loading…
Cancel
Save