isLoggedIn method

Future isLoggedIn()

Implementation

Future<dynamic> isLoggedIn() async {
  Completer completer = Completer();
  void isLoginCallBackFunction(js.JsObject response) {
    completer.complete(response);
  }
  js.context['isLoginCallBack'] = isLoginCallBackFunction;

  String jsCode = '''
          if (window.KommunicateGlobal == null) {
            isLoginCallBack(false);
          } else {
            isLoginCallBack(true);
          }
      ''';

  await js.context.callMethod('eval', [jsCode]);
  return completer.future;
}