accessToken property

Future<VKAccessToken?> accessToken

Returns access token if the user is logged in.

If the user is not logged in, then returns null.

Implementation

Future<VKAccessToken?> get accessToken async {
  assert(_initialized,
      'SDK is not initialized. You should call initSdk() first');
  if (!_initialized) return null;

  final tokenResult = await _channel
      .invokeMethod<Map<dynamic, dynamic>>(_methodGetAccessToken);

  return tokenResult != null
      ? VKAccessToken.fromMap(tokenResult.cast<String, dynamic>())
      : null;
}