decryptValue method

String decryptValue(
  1. String value, {
  2. bool failOnInvalid = true,
})

Decrypts a config value produced by encryptValue (or encrypted at rest in env files). Values MUST carry the ENC: prefix: any non-empty value without it throws a FormatException — plaintext values are not supported. An empty value is returned unchanged.

When failOnInvalid is false, values that cannot be decrypted (missing the ENC: prefix, malformed base64, or failing GCM authentication) are returned unchanged instead of throwing. Use this for values sourced from systems that may still deliver plaintext (e.g. remote config flags).

Implementation

String decryptValue(String value, {bool failOnInvalid = true}) =>
    decodeConfigValue(value, failOnInvalid: failOnInvalid);