setBasicAuthorization method
Adds basic authorization to requests from this agent.
Base-64 encodes username and password with a colon separator, and sets it for the key 'authorization' in headers.
Implementation
void setBasicAuthorization(String username, String? password) {
headers["authorization"] =
"Basic ${base64.encode("$username:${password ?? ""}".codeUnits)}";
}