deleteFromStorage static method

Future<void> deleteFromStorage(
  1. String path
)

Deletes the file system directory handle that would store sqlite3 databases when using loadFromStorage with the same path.

Implementation

static Future<void> deleteFromStorage(String path) async {
  final FileSystemDirectoryHandle? parent;
  final FileSystemDirectoryHandle handle;

  try {
    (parent, handle) = await _resolveDir(path, create: false);
  } on DOMException catch (e) {
    if (e.name == 'NotFoundError' || e.name == 'TypeMismatchError') {
      // Directory doesn't exist, ignore.
      return;
    } else {
      rethrow;
    }
  }

  if (parent != null) {
    await parent
        .removeEntry(handle.name, FileSystemRemoveOptions(recursive: true))
        .toDart;
  }
}