create static method

TokenInfo? create(
  1. {required String accessToken,
  2. required DateTime expirationDate,
  3. required bool isSslRequired}
)

Creates an instance of token info from given parameters.

Parameters:

  • accessToken — The access token string.
  • expirationDate — The token expiration date.
  • isSslRequired — A Boolean value that indicates whether the token must be passed over HTTPS.

Implementation

static TokenInfo? create(
    {required String accessToken,
    required DateTime expirationDate,
    required bool isSslRequired}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreAccessToken = _CString(accessToken);
  final coreExpirationDate = expirationDate.toArcGIS();
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_TokenInfo_create(coreAccessToken.bytes,
        coreExpirationDate._handle, isSslRequired, errorHandler);
  });
  if (handle == ffi.nullptr) return null;
  final TokenInfo object = TokenInfo._withHandle(handle);
  object._expirationDate.cache(expirationDate);
  return object;
}