void setBasicAuthorization(String username, String password)

Sets the Authorization header of this request.

Will apply the following header to this request:

    Authorization: Basic Base64(username:password)

Source

void setBasicAuthorization(String username, String password) {
  addHeader(HttpHeaders.AUTHORIZATION,
      "Basic ${new Base64Encoder().convert("$username:$password".codeUnits)}");
}