deleteAll static method

Future deleteAll({
  1. bool andFromBackpack = false,
  2. List<String>? excludeKeys,
})

Deletes all keys with associated values.

Implementation

static Future deleteAll(
    {bool andFromBackpack = false, List<String>? excludeKeys}) async {
  if (excludeKeys != null && excludeKeys.isNotEmpty) {
    Map<String, String> allValues = await readAll();
    for (String key in excludeKeys) {
      allValues.remove(key);
    }
    for (var data in allValues.entries) {
      await delete(data.key, andFromBackpack: andFromBackpack);
    }
    return;
  }

  if (andFromBackpack == true) {
    Backpack.instance.deleteAll();
  }
  await manager().deleteAll();
}