Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
Add an isReady getter to KvStore
Browse files Browse the repository at this point in the history
  • Loading branch information
synw committed Oct 30, 2019
1 parent cb5cdae commit 92493cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/store.dart
Expand Up @@ -25,6 +25,7 @@ class KvStore {
final bool inMemory;

final Completer _readyCompleter = Completer<void>();
bool _isReady = false;

Db _db;
final _pushFeed = StreamController<List<dynamic>>.broadcast();
Expand All @@ -50,7 +51,10 @@ class KvStore {
}

/// The ready callback
Future get onReady => _readyCompleter.future;
Future<void> get onReady => _readyCompleter.future;

/// Is the store ready
bool get isReady => _isReady;

/// Count all rows in the store
Future<int> count() async {
Expand Down Expand Up @@ -254,6 +258,7 @@ class KvStore {

/// Run the queue for the [push] method
unawaited(_runQueue());
_isReady = true;
_readyCompleter.complete();
}

Expand Down

0 comments on commit 92493cb

Please sign in to comment.