fromString static method

CryptAlgorithm fromString(
  1. String s
)

Converte uma string (vinda de JSON) para o enum correspondente.

Lança ArgumentError para strings não reconhecidas.

CryptAlgorithm.fromString('aes-gcm'); // CryptAlgorithm.aesGcm

Implementation

static CryptAlgorithm fromString(String s) => values.firstWhere(
      (e) => e.value == s,
      orElse: () =>
          throw ArgumentError('CryptAlgorithm desconhecido: "$s".'),
    );