deriveAccountInBackground function

Future<Account> deriveAccountInBackground(
  1. String mnemonic, {
  2. String passphrase = '',
})

Account.fromMnemonic in a background isolate (returns the private key hex; rebuild the account with Account.fromPrivateKey — the Account object itself is not sendable).

Implementation

Future<Account> deriveAccountInBackground(String mnemonic,
    {String passphrase = ''}) async {
  final priv = await Isolate.run(() =>
      Account.fromMnemonic(mnemonic, passphrase: passphrase).privateKeyHex);
  return Account.fromPrivateKey(priv);
}