hasValidCredentials method

Future<bool> hasValidCredentials()

Verifies whether the appId is valid

Implementation

Future<bool> hasValidCredentials() async {
  if (_headlessWebView == null) {
    throw StateError(
        'The hasValidCredentials method cannot be called after destroying the session');
  }

  if (!_completer.isCompleted) {
    if (_me == null) {
      throw StateError(
          'The me property needs to be set for the Session object before calling hasValidCredentials');
    }

    if (kDebugMode) {
      print(
          '📗 session hasValidCredentials: !_completer.isCompleted, awaiting for _completer.future');
    }
    await _completer.future;
  }

  if (kDebugMode) {
    print('📗 session hasValidCredentials: execute');
  }

  final bool isValid =
      await _executeAsync('return await session.hasValidCredentials();');

  return isValid;
}