0

I set a variable to an instance of BIP32 in a function, but accessing the varialble in a compute returns null

Map checkRoot(a) {
  print(root); // null
}
Map calculateSeed(String seedPhrase) {
  seed = bip39.mnemonicToSeed(seedPhrase);
  return {'root': bip32.BIP32.fromSeed(seed), 'seed': seed};
}
Future<void> initializeAllPrivateKeys(String mnemonic) async {
  Map seedDetails = await compute(calculateSeed, mnemonic);
  root = seedDetails['root'];
  seed = seedDetails['seed'];
  print(root); // 'Instance of BIP32'
  await compute(checkRoot, '');
}

What I expected

Map checkRoot(a) {
  print(root); // 'Instance of BIP32'
}

2
  • As mentioned by the dart:isolate documentation, Isolates don't share memory. (That's what makes them isolated.) Commented Dec 19, 2022 at 8:52
  • so please...how do i acess the variable Commented Dec 19, 2022 at 9:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.