removeModel static method

Future<void> removeModel(
  1. String table,
  2. String id
)

Implementation

static Future<void> removeModel(String table, String id) async {
  try {
    String key = 'database_table_$table';

    List<Map<String, dynamic>>? models = await getModels(table);

    if (models == null) {
      return;
    }

    List<String>? data = await compute(removeDatabaseModel, {
      'table': table,
      'id': id,
      'models': models,
    });

    if (data == null) {
      return;
    }

    await getSharedPreferences().setStringList(key, data);
  } catch (e) {
    print(e);
  }
}