removeByKey method

  1. @override
Future<void> removeByKey(
  1. String key, {
  2. bool rebuildDb = false,
})
override

Remove data from storage by key.

Setting rebuildDb to true will clean up the SQL database and free up the space.

Implementation

@override
Future<void> removeByKey(String key, {bool rebuildDb = false}) async {
  final db = await _getDb();
  await db.delete(
    _cacheTable,
    where: '$_cacheKey = ?',
    whereArgs: [key],
  );
  if (rebuildDb) await db.execute('vacuum');
}