createDefaultSyncGeodatabaseParametersWithSyncDirection method

Future<SyncGeodatabaseParameters> createDefaultSyncGeodatabaseParametersWithSyncDirection({
  1. required Geodatabase geodatabase,
  2. required SyncDirection syncDirection,
})

Creates default parameters for a sync geodatabase using the given sync direction.

This populates the parameters with values that match the geodatabase sync task's feature service and the geodatabase. For a geodatabase with SyncModel.layer then all geodatabase layers will be included. A service is editable if it has capabilities that include any of create, update or delete. In this case both SyncDirection.bidirectional and SyncDirection.upload are supported sync directions. Alternatively, a service that does not have create, update or delete capability is considered read-only and only SyncDirection.download will be supported. If the given sync direction is not compatible with the geodatabase sync task's feature service or the geodatabase is not sync-enabled, the returned task will fail.

Parameters:

  • geodatabase — a geodatabase to sync.
  • syncDirection — the sync direction to use.

Return Value: Returns a Future containing a sync parameter object of type SyncGeodatabaseParameters with the given sync direction. Other parameters are populated with default values.

Implementation

Future<SyncGeodatabaseParameters>
    createDefaultSyncGeodatabaseParametersWithSyncDirection({
  required Geodatabase geodatabase,
  required SyncDirection syncDirection,
}) {
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore
        .RT_GeodatabaseSyncTask_createDefaultSyncGeodatabaseParametersWithSyncDirectionAsync(
      _handle,
      geodatabase._handle,
      syncDirection.coreValue,
      errorHandler,
    );
  });
  return taskHandle.toFuture(
    (element) => element.getValueAsSyncGeodatabaseParameters()!,
  );
}