fromName static method

Commitment fromName(
  1. String value, {
  2. Commitment? defaultValue,
})

Implementation

static Commitment fromName(String value, {Commitment? defaultValue}) {
  return values.firstWhere((e) => e.value == value, orElse: () {
    if (defaultValue == null) {
      throw const SolanaPluginException("Invalid commitment");
    }
    return defaultValue;
  });
}