serverUrl static method

Future<Uri> serverUrl()

The URL of a runtime the platform layer started on its own.

Platforms that can boot the VM before the Flutter engine exists do so, and this completes as soon as the embedded server has bound its port — immediately, when the VM finished booting while the engine was still starting. Apps using this do not call start; the platform owns the runtime's lifecycle and reads its configuration from the app bundle.

Do not await this before runApp. The VM is already booting in parallel with the engine, and blocking startup on it hands back the time that parallelism was there to save. Request it from the widget tree and show a splash until it resolves.

Throws a PlatformException if the platform has no autostarted runtime, or if the runtime failed before binding.

Implementation

static Future<Uri> serverUrl() {
  return RufletRuntimePlatform.instance.serverUrl();
}