beforeStart method

Future<void> beforeStart(
  1. Keyring keyring, {
  2. KeyringEVM? keyringEVM,
  3. WebViewRunner? webView,
  4. String? jsCode,
  5. Function? socketDisconnectedAction,
  6. bool isEVM = false,
})

This method will be called while App switched to a plugin. In this method, the plugin will init WalletSDK and start a webView for running polkadot-js/api.

Implementation

Future<void> beforeStart(
  Keyring keyring, {
  KeyringEVM? keyringEVM,
  WebViewRunner? webView,
  String? jsCode,
  Function? socketDisconnectedAction,
  bool isEVM = false,
}) async {
  await sdk.init(keyring,
      keyringEVM: keyringEVM,
      webView: webView,
      jsCode: jsCode ?? (await loadJSCode()),
      socketDisconnectedAction: socketDisconnectedAction,
      isEVM: isEVM);
  await (isEVM ? onWillStartEVM(keyringEVM!) : onWillStart(keyring));
}