Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Apr 30, 2021
1 parent 3a6f71a commit a5a1992
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 6 additions & 3 deletions lib/src/async/async_queue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ class AsyncQueue<T> {

/// Add block to queue.
Future<T> enqueue(AsyncQueueBlock<T> block) {
if (_bag.isDisposed) {
throw StateError('AsyncQueue has been disposed!');
}
assert(() {
if (_bag.isClearing || _bag.isDisposed) {
throw StateError('AsyncQueue has been disposed!');
}
return true;
}());

final completer = Completer<T>.sync();
_blockS.add(_AsyncQueueEntry(completer, block));
Expand Down
8 changes: 2 additions & 6 deletions lib/src/impl/real_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,12 @@ class RealRxStorage<Key extends Object, Options,
void _publishLog(LoggerEvent<Key, Options> event) {
assert(_debugAssertNotDisposed());

try {
_loggerEventController!.add(event);
} on StateError {
assert(_debugAssertNotDisposed());
}
_loggerEventController!.add(event);
}

bool _debugAssertNotDisposed() {
assert(() {
if (_bag.isDisposed && _disposeMemo.hasRun) {
if (_bag.isClearing || _bag.isDisposed) {
throw StateError('A $runtimeType was used after being disposed.\n'
'Once you have called dispose() on a $runtimeType, it can no longer be used.');
}
Expand Down

0 comments on commit a5a1992

Please sign in to comment.