init method
dynamic
init()
Implementation
init() async {
// Observatory URL is like: http://127.0.0.1:8181/u31D8b3VvmM=/
// Websocket endpoint for that will be: ws://127.0.0.1:8181/reBbXy32L6g=/ws
final serverUri = (await dev.Service.getInfo()).serverUri;
if (serverUri == null) {
throw Exception("No VM service. Run with --enable-vm-service");
}
final wsUri = vmutils.convertToWebSocketUrl(serviceProtocolUrl: serverUri);
// Get VM service
_service = await vms.vmServiceConnectUri(wsUri.toString());
// Get currently running VM
final vm = await _service!.getVM();
// Fetch main isolate's id
_mainIsolate = vm.isolates!.first.id;
}