mnemonicToSeed function

Uint8List mnemonicToSeed(
  1. String mnemonic
)

Implementation

Uint8List mnemonicToSeed(String mnemonic) {
  /// Normalize the case and spacing in the mnemonic (throws if the mnemonic is invalid)
  final wordsList = mnemonic.split(' ');
  wordsList.removeWhere((word) => word == '');
  mnemonic = wordsList.join(' ');
  if (!bip39.validateMnemonic(mnemonic)) {
    throw 'invalid mnemonic';
  }

  final seed = bip39.mnemonicToSeed(mnemonic);
  return seed;
}