erase method
Delete all records from the table
Implementation
Future<void> erase() async {
try {
final db = await database;
final data = await all();
if (data != null) {
for (final model in data) {
await db.delete(
table,
where: 'id = ?',
whereArgs: [model.toMap()['id']],
);
}
}
} catch (e) {
throw DatabaseException('Failed to erase table: $e');
}
}