clear method

  1. @override
Future<void> clear([
  1. String? tableName
])
override

清空表所有数据

Implementation

@override
Future<void> clear([String? tableName]) async {
  try {
    await db.execute("delete from ${tableName ?? table}");
    //reset the auto increase id
    await db.execute("update sqlite_sequence SET seq = 0 where name ='${tableName ?? table}';");
  } catch (e) {
    print(e);
  }
}