clear method

  1. @override
Future<void> clear()
override

Clear all data from local storage

Implementation

@override
/// Clear all data from local storage
Future<void> clear() async {
  try {
    if (path == null) {
      await setup();
    }
    if (path != null) {
      Directory dir = Directory(path!);
      if (await dir.exists()) {
        List<FileSystemEntity> files = dir.listSync();
        for (FileSystemEntity file in files) {
          if (file is File) {
            await file.delete();
          }
        }
      }
    }
  } on Exception catch (e) {
    debugPrint(e.toString());
  }
}