I would comment on Günter's April 10th, 2016, post, but I don't have the reputation. As he says, you should use the dart:convert
library, now. You have to combine a couple of codecs to get a utf8 string out of a base64 string and vice-versa. This article says that fusing your codecs is faster.
import 'dart:convert';
void main() {
var base64 = 'QXdlc29tZSE=';
var utf8 = 'Awesome!';
// Combining the codecs
print(utf8 == UTF8.decode(BASE64.decode(base64)));
print(base64 == BASE64.encode(UTF8.encode(utf8)));
// Output:
// true
// true
// Fusing is faster, and you don't have to worry about reversing your codecs
print(utf8 == UTF8.fuse(BASE64).decode(base64));
print(base64 == UTF8.fuse(BASE64).encode(utf8));
// Output:
// true
// true
}
https://dartpad.dartlang.org/5c0e1cfb6d1d640cdc902fe57a2a687d
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…