logout method
Implementation
Future<dynamic> logout() async {
Completer completer = Completer();
void loggedOutcallbackFunction(js.JsObject response) {
completer.complete(response);
}
js.context['loggedOut'] = loggedOutcallbackFunction;
String jsCode = '''
try {
Kommunicate.logout();
loggedOut("true");
} catch (error) {
console.error("An error occurred while logging out:", error);
loggedOut("false");
}
''';
await js.context.callMethod('eval', [jsCode]);
return completer.future;
}