switchVersion method

Future<void> switchVersion({
  1. required String versionName,
})

Switches all connected feature tables to the new version.

An error is thrown if:

Check the result of ServiceGeodatabase.hasLocalEdits before attempting to switch versions, to make sure all changes are saved to the service or discarded from the local cache. Use the ServiceGeodatabase.applyEdits or ServiceGeodatabase.undoLocalEdits methods as appropriate to save or discard changes before switching versions.

Parameters:

  • versionName — The name of the version to connect to.

Return Value: A Future that has no value.

Implementation

Future<void> switchVersion({
  required String versionName,
}) {
  final coreVersionName = _CString(versionName);
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_ServiceGeodatabase_switchVersionAsync(
      _handle,
      coreVersionName.bytes,
      errorHandler,
    );
  });
  return taskHandle.toFuture(
    (_) {},
  );
}