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() {
final str = "Hello world";
final bytes = utf8.encode(str);
final base64Str = base64.encode(bytes);
print(base64Str);
}