📜  颤振编码 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:04.953000             🧑  作者: Mango

代码示例1
import 'dart:convert';
// Base64
// ======
String credentials = "username:password";
Codec stringToBase64 = utf8.fuse(base64);
String encoded = stringToBase64.encode(credentials); // dXNlcm5hbWU6cGFzc3dvcmQ=
String decoded = stringToBase64.decode(encoded);  // username:password

// Note that this is equivalent to:
String encoded = base64.encode(utf8.encode(credentials)); // dXNlcm5hbWU6cGFzc3dvcmQ=
String decoded = utf8.decode(base64.decode(encoded));