Interface GeolocationOutcome

All Superinterfaces:
GeolocationResult, Serializable
All Known Implementing Classes:
GeolocationError, GeolocationPosition

public sealed interface GeolocationOutcome extends GeolocationResult permits GeolocationPosition, GeolocationError
The actual answer to a geolocation request — either a successful reading or an error. Narrower than GeolocationResult: the "waiting for first reading" GeolocationPending state is excluded because one-shot Geolocation.get(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.geolocation.GeolocationOutcome>) never produces it.

Returned to the callback of Geolocation.get(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.geolocation.GeolocationOutcome>). Use this instead of GeolocationResult when you only need to handle the Position / Error branches and want the switch to stay exhaustive without a dead Pending arm.

 ui.getGeolocation().get(outcome -> {
     switch (outcome) {
     case GeolocationPosition pos -> showNearest(pos);
     case GeolocationError err -> showManualEntry();
     }
 });