bytesToBase64 static method

String bytesToBase64(
  1. List<int> bytes, [
  2. bool urlSafe = false,
  3. bool addLineSeparator = false
])

Converts a list of bytes into a Base 64 encoded string.

The list can be any list of integers in the range 0..255, for example a message digest.

If addLineSeparator is true, the resulting string will be broken into lines of 76 characters, separated by "\r\n".

If urlSafe is true, the result is URL and filename safe.

Based on RFC 4648

Implementation

static String bytesToBase64(List<int> bytes,
        [bool urlSafe = false, bool addLineSeparator = false]) =>
    new Base64Encoder(urlSafe, addLineSeparator).convert(bytes);