addForUri method

void addForUri({
  1. required ArcGISCredential credential,
  2. required Uri uri,
})

Adds a specified credential to the store for a given URL. The URL must be shareable with the server context of the credential. Otherwise, this method throws an ArcGISExceptionType.authenticationCredentialCannotBeShared. When the credential is added to the store with this function, for the credential to be shared with a secured service endpoint, the service endpoint must begin with the specified URL passed to this function call. For example, if you were to specify a store URL of https://www.server.net/arcgis/rest/services/service1/ when calling this function, then the specified credential would be shared with an endpoint such as https://www.server.net/arcgis/rest/services/service1/query, but not for https://www.server.net/arcgis/rest/services/service2/query.

If a credential was already stored for the same URL then it will be replaced.

Parameters:

  • credential — The credential to be stored within ArcGISCredentialStore.
  • uri — The URL to associate the credential with.

Implementation

void addForUri({
  required ArcGISCredential credential,
  required Uri uri,
}) {
  final coreURI = _CString(uri.toString());
  _withThrowingErrorHandler((errorHandler) {
    runtimecore.RT_ArcGISCredentialStore_addForURL(
      _handle,
      credential._handle,
      coreURI.bytes,
      errorHandler,
    );
  });
}