fromBase64Strict static method

Uint8List fromBase64Strict(
  1. String b64
)

Decodes a standard Base64 string to bytes.

  • Trims ASCII whitespace.
  • Auto-fixes missing padding if input length % 4 != 0.
  • Throws FormatException if still invalid after normalization.

HINT: Use this for wire inputs; it is strict after normalization.

Implementation

static Uint8List fromBase64Strict(String b64) {
  // Remove whitespace often added by intermediaries.
  final normalized = _normalizeB64(b64);
  return Uint8List.fromList(base64.decode(normalized));
}