clear method

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

清空表所有数据

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);
  }
}