username property

String username

A string containing the username specified before the domain name.

MDN reference

Implementation

String get username => _uri.userInfo.split(':').first;
void username=(String value)

Implementation

set username(String value) {
  if (value.isEmpty) return;
  if (password.isEmpty) {
    _uri = _uri.replace(userInfo: value);
    return;
  }

  _uri = _uri.replace(userInfo: '$value:$password');
}