currentAccessToken property

Future<StoredAccessToken?> currentAccessToken

Gets the current access token in use.

This returns a Future<StoredAccessToken>, with the access token value contained in the result StoredAccessToken.value. If the user isn't logged in, it returns a null value as the Future result.

A valid StoredAccessToken object doesn't necessarily mean the access token itself is valid. It may have expired or been revoked by the user from another device or LINE client.

This method redirects calls to the LINE SDK for the relevant native platform (iOS or Android). If an error happens in the native platform, a PlatformException is thrown. See PlatformException.code and PlatformException.message for error details.

The LINE SDK implementation differs between iOS and Android, which means error codes and messages can also be different. For platform-specific error information, see LineSDKError (iOS) and LineApiError (Android).

Implementation

Future<StoredAccessToken?> get currentAccessToken async {
  String? result = await channel.invokeMethod('currentAccessToken');
  if (result == null) return null;
  return StoredAccessToken._(_decodeJson(result));
}