Skip to content

Commit 02d7cb6

Browse files
committed
fix a few warnings/hints.
1 parent 21d7b4a commit 02d7cb6

File tree

5 files changed

+44
-29
lines changed

5 files changed

+44
-29
lines changed

lib/src/crypto/key_encrypter_kdf.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ class KeyEncrypterKdf {
101101
case KdfType.Aes:
102102
_logger.fine('Must be using aes');
103103
return await encryptAes(key, kdfParameters);
104-
default:
105-
throw UnsupportedError('unsupported KDF Type $kdfType.');
106104
}
107105
}
108106

lib/src/crypto/protected_value.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PlainValue implements StringValue {
2525
}
2626

2727
@override
28-
bool operator ==(dynamic other) => other is PlainValue && other.text == text;
28+
bool operator ==(Object other) => other is PlainValue && other.text == text;
2929

3030
@override
3131
int get hashCode => text.hashCode;
@@ -76,7 +76,7 @@ class ProtectedValue implements StringValue {
7676
}
7777

7878
@override
79-
bool operator ==(dynamic other) =>
79+
bool operator ==(Object other) =>
8080
other is ProtectedValue && other.getText() == getText();
8181

8282
int? _hashCodeCached;

lib/src/utils/scope_functions.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/lib/scope_functions.dart
22
/// MIT license: https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/LICENSE
3+
library;
34

45
ReturnType run<ReturnType>(ReturnType Function() operation) {
56
return operation();

test/internal/byte_utils_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dart:io';
21
import 'dart:typed_data';
32

43
import 'package:kdbx/src/utils/byte_utils.dart';

test/kdbx_history_test.dart

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: deprecated_member_use
2+
13
import 'dart:async';
24

35
import 'package:kdbx/kdbx.dart';
@@ -8,19 +10,23 @@ import 'internal/test_utils.dart';
810

911
class StreamExpect<T> {
1012
StreamExpect(this.stream) {
11-
stream.listen((event) {
12-
if (_expectNext == null) {
13-
fail('Got event, but none was expected. $event');
14-
}
15-
expect(event, _expectNext!.orNull);
16-
_expectNext = null;
17-
}, onDone: () {
18-
expect(_expectNext, isNull);
19-
isDone = true;
20-
}, onError: (dynamic error) {
21-
expect(_expectNext, isNull);
22-
this.error = error;
23-
});
13+
stream.listen(
14+
(event) {
15+
if (_expectNext == null) {
16+
fail('Got event, but none was expected. $event');
17+
}
18+
expect(event, _expectNext!.orNull);
19+
_expectNext = null;
20+
},
21+
onDone: () {
22+
expect(_expectNext, isNull);
23+
isDone = true;
24+
},
25+
onError: (dynamic error) {
26+
expect(_expectNext, isNull);
27+
this.error = error;
28+
},
29+
);
2430
}
2531

2632
Future<RET> expectNext<RET>(T value, FutureOr<RET> Function() cb) async {
@@ -63,34 +69,45 @@ void main() {
6369
});
6470
}
6571
expect(file.dirtyObjects, hasLength(1));
66-
final f2 = await dirtyExpect
67-
.expectNext({}, () async => testUtil.saveAndRead(file));
72+
final f2 = await dirtyExpect.expectNext(
73+
{},
74+
() async => testUtil.saveAndRead(file),
75+
);
6876
expect(file.dirtyObjects, isEmpty);
6977
{
7078
final first = f2.body.rootGroup.entries.first;
7179
expect(first.getString(TestUtil.keyTitle)!.getText(), value1);
72-
expect(first.history.last.getString(TestUtil.keyTitle)!.getText(),
73-
valueOrig);
80+
expect(
81+
first.history.last.getString(TestUtil.keyTitle)!.getText(),
82+
valueOrig,
83+
);
7484
await dirtyExpect.expectNext({}, () async => file.save());
7585
}
7686

7787
// edit the original file again, and there should be a second history
7888
{
7989
final first = file.body.rootGroup.entries.first;
80-
await dirtyExpect.expectNext({first},
81-
() async => first.setString(TestUtil.keyTitle, PlainValue(value2)));
90+
await dirtyExpect.expectNext({
91+
first,
92+
}, () async => first.setString(TestUtil.keyTitle, PlainValue(value2)));
8293
}
83-
final f3 = await dirtyExpect
84-
.expectNext({}, () async => testUtil.saveAndRead(file));
94+
final f3 = await dirtyExpect.expectNext(
95+
{},
96+
() async => testUtil.saveAndRead(file),
97+
);
8598
expect(file.dirtyObjects, isEmpty);
8699
{
87100
final first = f3.body.rootGroup.entries.first;
88101
expect(first.getString(TestUtil.keyTitle)!.getText(), value2);
89102
expect(first.history, hasLength(2));
90103
expect(
91-
first.history.last.getString(TestUtil.keyTitle)!.getText(), value1);
92-
expect(first.history.first.getString(TestUtil.keyTitle)!.getText(),
93-
valueOrig);
104+
first.history.last.getString(TestUtil.keyTitle)!.getText(),
105+
value1,
106+
);
107+
expect(
108+
first.history.first.getString(TestUtil.keyTitle)!.getText(),
109+
valueOrig,
110+
);
94111
await dirtyExpect.expectNext({}, () async => file.save());
95112
}
96113
file.dispose();

0 commit comments

Comments
 (0)