deleteDatabase method Null safety

Future<IdbFactory> deleteDatabase (
  1. String name,
  2. {void onBlocked(
    1. Event e
    )}
)

Implementation

Future<IdbFactory> deleteDatabase(String name, {void onBlocked(Event e)?}) {
  try {
    var request = _deleteDatabase(name);

    if (onBlocked != null) {
      request.onBlocked.listen(onBlocked);
    }
    var completer = new Completer<IdbFactory>.sync();
    request.onSuccess.listen((e) {
      completer.complete(this);
    });
    request.onError.listen(completer.completeError);
    return completer.future;
  } catch (e, stacktrace) {
    return new Future.error(e, stacktrace);
  }
}