fromString static method

KeyAlgorithm fromString(
  1. String algorithm
)

Returns the KeyAlgorithm corresponding to the given string algorithm.

Throws an ArgumentError if the algorithm is invalid.

Implementation

static KeyAlgorithm fromString(String algorithm) {
  return KeyAlgorithm.values.firstWhere(
    (e) => e.value == algorithm,
    orElse: () => throw ArgumentError('Invalid KeyAlgorithm: $algorithm'),
  );
}