generate static method

Mnemonic generate({
  1. int words = 12,
})

BIP39: Since the vast majority of BIP39 wallets supports only the English wordlist, it is strongly discouraged to use non-English wordlists.

Substrate-BIP39 also only supports english wordlist.

Implementation

static Mnemonic generate({int words = 12}) {
  final wordsToEntropy = {
    12: MnemonicLength.words12,
    15: MnemonicLength.words15,
    18: MnemonicLength.words18,
    21: MnemonicLength.words21,
    24: MnemonicLength.words24,
  };
  final entropy = wordsToEntropy[words];
  if (entropy == null) {
    throw SubstrateBip39Exception.invalidEntropy(
        'Invalid number of words given for phrase, must be 12/15/18/21/24');
  }
  return Mnemonic.generate(Language.english, length: entropy);
}