import 'dart:convert'; String encoded = base64.encode(utf8.encode(credentials)); // dXNlcm5hbWU6cGFzc3dvcmQ= String decoded = utf8.decode(base64.decode(encoded)); // username:password