open method

  1. @DomName('IDBFactory.open')
Future<Database> open(String name, { int version, void onUpgradeNeeded(VersionChangeEvent), void onBlocked(Event) })

Source

@DomName('IDBFactory.open')
Future<Database> open(String name,
    {int version,
    void onUpgradeNeeded(VersionChangeEvent),
    void onBlocked(Event)}) {
  if ((version == null) != (onUpgradeNeeded == null)) {
    return new Future.error(new ArgumentError(
        'version and onUpgradeNeeded must be specified together'));
  }
  try {
    var request;
    if (version != null) {
      request = _open(name, version);
    } else {
      request = _open(name);
    }

    if (onUpgradeNeeded != null) {
      request.onUpgradeNeeded.listen(onUpgradeNeeded);
    }
    if (onBlocked != null) {
      request.onBlocked.listen(onBlocked);
    }
    return _completeRequest(request);
  } catch (e, stacktrace) {
    return new Future.error(e, stacktrace);
  }
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-indexed_db/IdbFactory/open.html