toBase64 method
Encodes the string to Base64 format.
This method converts the string to bytes and then encodes those bytes to Base64.
Returns a String representing the Base64 encoded version of the original string.
Implementation
String toBase64() {
return base64.encode(codeUnits);
}