disconnect method

  1. @override
Future<bool> disconnect()
override

Implementation

@override
Future<bool> disconnect() async {
  if (_serviceNotReady) {
    throw Exception('Service is not ready');
  }
  //
  _disconnectCompleter = Completer<bool>();
  if (!isConnected.value) {
    _resetTimeOut();
    _disconnectCompleter.complete(true);
    return await _disconnectCompleter.future;
  }
  final message = SignOut().toString();
  await _webViewController.runJavaScript('sendMessage($message)');
  return await _disconnectCompleter.future;
}