Skip to content

Commit 60b8177

Browse files
committed
removed assert type
1 parent 2249522 commit 60b8177

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

lib/src/impl/real_storage.dart

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,10 @@ class RealRxStorage<Key extends Object, Options,
316316
assert(_debugAssertNotDisposed());
317317
assert(key != null);
318318

319-
FutureOr<T?> convert(KeyAndValue<Object, Object?> entry) {
320-
if (identical(entry, _initialKeyValue)) {
321-
return _useStorage((s) => s.read<T>(key, decoder, options));
322-
} else {
323-
// ignore assertion if [entry.type] is `Null` or `dynamic`.
324-
assert(entry.type == Null || entry.type == dynamic || entry.type == T);
325-
return entry.value as FutureOr<T?>;
326-
}
327-
}
319+
FutureOr<T?> convert(KeyAndValue<Object, Object?> entry) =>
320+
identical(entry, _initialKeyValue)
321+
? _useStorage((s) => s.read<T>(key, decoder, options))
322+
: entry.value as FutureOr<T?>;
328323

329324
final stream = _keyValuesSubject
330325
.toSingleSubscriptionStream()

test/storage/streams_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ void main() {
6969
noSuchStream,
7070
emits(isNull),
7171
);
72+
73+
expect(
74+
rxStorage.getStringStream('String'),
75+
emitsInOrder(<Matcher>[
76+
anything,
77+
emitsError(isA<TypeError>()),
78+
]),
79+
);
80+
await pumpEventQueue(times: 50);
81+
await rxStorage.setDouble('String', 999);
7282
},
7383
);
7484

0 commit comments

Comments
 (0)