ServiceGeodatabase.withUri constructor

ServiceGeodatabase.withUri(
  1. Uri uri, {
  2. String versionName = '',
  3. FeatureServiceSessionType sessionType = FeatureServiceSessionType.transient,
})

Creates a new ServiceGeodatabase connected to a specific version in a feature service.

If a version with the name does not exist, or the service is not branch versioned, the ServiceGeodatabase will fail to load.

If using FeatureServiceSessionType.persistent and the service is not branch versioned, the ServiceGeodatabase will fail to load.

If using FeatureServiceSessionType.persistent, it is important to call ServiceGeodatabase.close before destruction.

Parameters:

  • uri — The URL of the feature service or the portal item to connect to.
  • versionName — The existing version to connect to when the ServiceGeodatabase loads.
  • sessionType — The type of read and edit sessions to use when working with the service.

Implementation

factory ServiceGeodatabase.withUri(
  Uri uri, {
  String versionName = '',
  FeatureServiceSessionType sessionType = FeatureServiceSessionType.transient,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreURI = _CString(uri.toString());
  final coreVersionName = _CString(versionName);
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_ServiceGeodatabase_createWithUriCombined(
      coreURI.bytes,
      coreVersionName.bytes,
      sessionType.coreValue,
      errorHandler,
    );
  });
  return ServiceGeodatabase._instanceCache.instanceWith(handle);
}