deleteById method

Future<void> deleteById(
  1. dynamic id
)

Implementation

Future<void> deleteById(final dynamic id) async {
  if (kIsWeb) {
    final List<b.Model> list = await selectAll();
    final List<b.Model> list2 = [];
    for (final b.Model object in list) {
      if ((object as Model).id != id) {
        list2.add(object);
      }
    }
    await deleteAll();
    await insertAll(list2);
  } else {
    await (await sqflite).delete('`${sqfliteTable.name}`',
        where: '`${sqfliteTable.id.name}` = ?',
        whereArgs: [await encryptId(id)]);
  }
}