How to native convert string -> base64 and base64 -> string
I\'m find only this bytes to base64string
would like this:
As of 0.9.2 of the crypto package
CryptoUtilsis deprecated. Use theBase64APIs indart:convertand the hex APIs in theconvertpackage instead.
import 'dart:convert' show utf8, base64;
main() {
final str = 'https://dartpad.dartlang.org/';
final encoded = base64.encode(UTF8.encode(str));
print('base64: $encoded');
final str2 = utf8.decode(base64.decode(encoded));
print(str2);
print(str == str2);
}
Try it in DartPad