HDWallet.fromMnemonic constructor

HDWallet.fromMnemonic(
  1. String mnemonic
)

mnemonic is string

Implementation

factory HDWallet.fromMnemonic(String mnemonic) {
  bool isValidate=validateMnemonic(mnemonic);
  if(isValidate){
    String seed=mnemonicToSeedHex(mnemonic);
    BIP32 bip32 = BIP32.fromSeed(HEX.decode(seed) as Uint8List);
    return HDWallet(bip32,pIsMaster: true);
  }else{
    throw  ArgumentError("mnemonic is validated");
  }

}