isBase64 function

bool isBase64(
  1. String str, {
  2. bool urlSafe = false,
})

Checks if the string is Base64 encoded.

By default the standard Base64 alphabet is used. Set urlSafe to true to validate against the URL- and filename-safe alphabet.

Example:

isBase64('aGVsbG8='); // true
isBase64('aGVsbG8'); // false (invalid padding)
isBase64('aGVsbG8', urlSafe: true); // true

Implementation

bool isBase64(String str, {bool urlSafe = false}) => _isBase64(str, urlSafe);