resetAsync method Null safety

Future<void> resetAsync()

Removes all tiles from this store synchronously

Also resets the cache hits & misses statistic.

This method requires the store to be ready, else an FMTCStoreNotReady error will be raised.

Implementation

Future<void> resetAsync() async {
  _ensureReadyStatus();

  final db = _registry.storeDatabases[_id]!;
  await db.writeTxn(() async {
    await db.tiles.clear();
    await db.storeDescriptor.put(
      (await db.storeDescriptor.get(0))!
        ..hits = 0
        ..misses = 0,
    );
  });
}