startLocalServer method
Future<void>
startLocalServer(
)
Implementation
Future<void> startLocalServer() async {
if (_localhostServer?.isRunning() == true) {
HttpClient client = HttpClient();
HttpClientRequest? request;
try {
request = await client.getUrl(Uri.parse('http://localhost:8080/'));
} catch (error) {
debugPrint(error.toString());
}
final response = await request?.close();
client.close();
if (response?.statusCode == 200) {
return;
}
}
await _localhostServer?.close();
await _localhostServer?.start();
}