W3cubDocs

/Dart 2

changeVersion method

  1. @JSName('changeVersion')
Future<SqlTransaction> changeVersion (String oldVersion, String newVersion)
@JSName('changeVersion')

Atomically update the database version to newVersion, asynchronously running callback on the SqlTransaction representing this changeVersion transaction.

If callback runs successfully, then successCallback is called. Otherwise, errorCallback is called.

oldVersion should match the database's current version exactly.

See also:

Implementation

@JSName('changeVersion')
/**
 * Atomically update the database version to [newVersion], asynchronously
 * running [callback] on the [SqlTransaction] representing this
 * [changeVersion] transaction.
 *
 * If [callback] runs successfully, then [successCallback] is called.
 * Otherwise, [errorCallback] is called.
 *
 * [oldVersion] should match the database's current [version] exactly.
 *
 * See also:
 *
 * * [Database.changeVersion](http://www.w3.org/TR/webdatabase/#dom-database-changeversion) from W3C.
 */
Future<SqlTransaction> changeVersion(String oldVersion, String newVersion) {
  var completer = new Completer<SqlTransaction>();
  _changeVersion(oldVersion, newVersion, (value) {
    completer.complete(value);
  }, (error) {
    completer.completeError(error);
  });
  return completer.future;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-web_sql/SqlDatabase/changeVersion.html