baseUrl property

String get baseUrl

Indicates the url of the {@link HubConnection} to the server.

Implementation

String get baseUrl => _connection!.baseUrl!;
set baseUrl (String url)

Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or Reconnecting states.

Implementation

set baseUrl(String url) {
  if ((_connectionState != HubConnectionState.disconnected) &&
      (_connectionState != HubConnectionState.reconnecting)) {
    throw Exception(
      'The HubConnection must be in the Disconnected or Reconnecting '
      'state to change the url.',
    );
  }

  if (url.isEmpty) {
    throw Exception('The HubConnection url must be a valid url.');
  }

  _connection!.baseUrl = url;
}