uri property

  1. @override
Uri get uri
override

Implementation

@override
Uri get uri {
  if (_server.address.isLoopback) {
    return Uri(scheme: 'http', host: 'localhost', port: _server.port);
  }

  // IPv6 addresses in URLs need to be enclosed in square brackets to avoid
  // URL ambiguity with the ":" in the address.
  if (_server.address.type == InternetAddressType.IPv6) {
    return Uri(
      scheme: 'http',
      host: '[${_server.address.address}]',
      port: _server.port,
    );
  }

  return Uri(
    scheme: 'http',
    host: _server.address.address,
    port: _server.port,
  );
}