deleteFromCollection<T> static method

Future deleteFromCollection<T>(
  1. int index, {
  2. required String key,
})

Delete an item of a collection using a index and the collection key.

Implementation

static Future deleteFromCollection<T>(int index,
    {required String key}) async {
  List<T> collection = await readCollection<T>(key);
  if (collection.isEmpty) return;
  collection.removeAt(index);
  await saveCollection<T>(key, collection);
}