init method

  1. @override
Future<void> init()
override

The service used to fetch wallet listings from the explorer API. Sets up the explorer and the web3App if they already been initialized.

Implementation

@override
Future<void> init() async {
  if (_isInitialized) {
    return;
  }

  _initError = null;
  try {
    await _web3App!.init();
    await WalletConnectModalServices.init();
  } catch (_) {}

  _registerListeners();

  if (_web3App!.sessions.getAll().isNotEmpty) {
    _isConnected = true;
    _session = _web3App!.sessions.getAll().first;
    _address = NamespaceUtils.getAccount(
      _session!.namespaces.values.first.accounts.first,
    );
  }

  _isInitialized = true;

  notifyListeners();
}