truncate<T extends Model> static method

Future<bool> truncate<T extends Model>()

Empties the table file.

Implementation

static Future<bool> truncate<T extends Model>() async {
  final file = File("$_dir/${_getTableName<T>()}.json");
  if (await file.exists()) {
    await file.writeAsString('[]', flush: true);
    return true;
  }
  return false;
}