There is no need to use the crypto package since the core libraries provide built-in support for base64 encoding and decoding.
https://api.dartlang.org/stable/2.1.0/dart-convert/dart-convert-library.html
import 'dart:convert';
main() {
var str = "Hello world";
var bytes = utf8.encode(str);
var base64Str = base64.encode(bytes);
print(base64Str);
}