startKeepingSynced method

Future<void> startKeepingSynced()

Keeps this query's data synchronised even with no listener, until stopKeepingSynced.

It is a flag, not a counter: calling it twice and stopKeepingSynced once turns it off. Without persistence it keeps the in-memory data and the server listen. The Future completes when the flag has been applied here, not when the data has arrived; after FirebaseDatabase.close it fails with database-closed. A .info path throws an ArgumentError at the call, not through the Future.

await db.ref('scores').orderByValue().limitToLast(10).startKeepingSynced();

Implementation

Future<void> startKeepingSynced() =>
    _keepSynced('startKeepingSynced', keep: true);