Interface GeolocationResult

All Superinterfaces:
Serializable
All Known Subinterfaces:
GeolocationOutcome
All Known Implementing Classes:
GeolocationError, GeolocationPending, GeolocationPosition

public sealed interface GeolocationResult extends Serializable permits GeolocationOutcome, GeolocationPending
Anything a tracker can currently hold — a successful reading, an error, or the initial "waiting for first reading" state.

Held by the signal exposed by GeolocationTracker.valueSignal(). A GeolocationResult is always exactly one of three things:

For the one-shot Geolocation.get(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.geolocation.GeolocationOutcome>) callback use the narrower GeolocationOutcome, which excludes GeolocationPending (one-shot requests never produce that value).

The sealed hierarchy is designed for exhaustive pattern matching. A switch covering the three permitted variants is guaranteed complete at compile time.

 switch (tracker.valueSignal().get()) {
 case GeolocationPending p -> showSpinner();
 case GeolocationPosition pos -> map.setCenter(pos.coords());
 case GeolocationError err -> showError(err.message());
 }