cleanAllTablesData method

Future<void> cleanAllTablesData()

Removes every row from every user-defined table of the database. The tables themselves are kept.

Implementation

Future<void> cleanAllTablesData() async {
  final List<String> tables = await getAColumnFromWithTableName<String>(
    'name',
    'sqlite_master',
    afterWhere: "type='table' AND name NOT LIKE 'sqlite_%'",
  );
  await (await db).transaction((txn) async {
    for (final String table in tables) {
      await txn.execute('DELETE FROM $table');
    }
  });
}