toString method
A string representation of this object.
Some classes have a default textual representation,
often paired with a static parse
function (like int.parse).
These classes will provide the textual representation as
their string representation.
Other classes have no meaningful textual representation
that a program will care about.
Such classes will typically override toString
to provide
useful information when inspecting the object,
mainly for debugging or logging.
Implementation
@override
String toString() {
List<String> headers = <String>[];
String uri = '$_scheme:';
if (user != null) {
uri += '${utils.escapeUser(user!)}@';
}
uri += host;
if (port != null || port == 0) {
uri += ':${port.toString()}';
}
_parameters.forEach((dynamic key, dynamic parameter) {
uri += ';$key';
if (_parameters[key] != null) {
uri += '=${_parameters[key].toString()}';
}
});
_headers.forEach((dynamic key, dynamic header) {
dynamic hdrs = _headers[key];
hdrs.forEach((dynamic item) {
headers.add('${utils.headerize(key)}=${item.toString()}');
});
});
if (headers.isNotEmpty) {
uri += '?${headers.join('&')}';
}
return uri;
}