isValidEntropyBitLen static method

bool isValidEntropyBitLen(
  1. int bitLen
)

Check if a given bit length is a valid BIP39 entropy bit length.

  • bitLen: The bit length to check for validity.
  • Returns: true if the bit length is valid, false otherwise.

Implementation

static bool isValidEntropyBitLen(int bitLen) {
  try {
    Bip39EntropyBitLen.values
        .firstWhere((element) => element.value == bitLen);
    return true;
  } on StateError {
    return false;
  }
}