connect method

  1. @override
Future<DesktopBrowserSession> connect({
  1. Duration? timeLimit,
  2. Uri? walletUriBase,
})

Establishes an encrypted session between the dApp and wallet endpoints.

This method should run in a synchronized block and can only be called once.

Implementation

@override
Future<DesktopBrowserSession> connect({
  final Duration? timeLimit,
  final Uri? walletUriBase,
}) async {

  final AppInfo? info = _info(walletUriBase);

  if (info == null) {
    throw _walletNotFound('The wallet application does not exist.');
  }

  final DesktopBrowserProvider? provider = _provider(info);

  if (provider == null || provider.object() == null) {
    throw _walletNotFound('The wallet application is not installed.');
  }

  return DesktopBrowserSession(provider);
}