baseUrl property
String
get
baseUrl
Get the base URL for the test server.
Returns the complete base URL (http://hostname:port) for making requests to the test server. Useful for constructing full URLs when needed.
Example:
print(testApp.baseUrl); // http://localhost:54321
final fullUrl = '${testApp.baseUrl}/api/users';
Throws StateError if the server has not been started yet.
Implementation
String get baseUrl {
if (_port == null || _hostname == null) {
throw StateError('TestApp is not started. Call start() first.');
}
return 'http://$_hostname:$_port';
}