import 'dart:convert';
void main() {
String credentials = "nilpointer:net";
Codec stringToBase64 = utf8.fuse(base64);
String encoded = stringToBase64.encode(credentials);
print("encoded: ${encoded}");
String decoded = stringToBase64.decode(encoded);
print("decoded: ${decoded}");
}
Output
encoded: bmlscG9pbnRlcjpuZXQ=
decoded: nilpointer:net