createCancelable static method

CancelableOperation<OAuthApplicationCredential> createCancelable(
  1. {required Uri portalUri,
  2. required String clientId,
  3. required String clientSecret,
  4. int tokenExpirationInterval = 0}
)

Cancelable version of create. See that method for more information.

Implementation

static CancelableOperation<OAuthApplicationCredential> createCancelable(
    {required Uri portalUri,
    required String clientId,
    required String clientSecret,
    int tokenExpirationInterval = 0}) {
  _initializeArcGISEnvironmentIfNeeded();
  final corePortalUri = _CString(portalUri.toString());
  final coreClientId = _CString(clientId);
  final coreClientSecret = _CString(clientSecret);
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_OAuthApplicationCredential_createAsync(
        corePortalUri.bytes,
        coreClientId.bytes,
        coreClientSecret.bytes,
        tokenExpirationInterval,
        errorHandler);
  });
  return taskHandle.toCancelableOperation(
      (element) => element.getValueAsOAuthApplicationCredential()!);
}