base64 top-level constant Null safety

Base64Codec const base64

A base64 encoder and decoder.

It encodes using the default base64 alphabet, decodes using both the base64 and base64url alphabets, does not allow invalid characters and requires padding.

Examples:

var encoded = base64.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
                             0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
var decoded = base64.decode("YmzDpWLDpnJncsO4ZAo=");

The top-level base64Encode and base64Decode functions may be used instead if a local variable shadows the base64 constant.

Implementation

const Base64Codec base64 = Base64Codec();