LocationResult class final

The result of a location change from the device

Constructors

LocationResult.new(Location location, {required PermissionStatus permissionStatus})
Successful result
const
LocationResult.error(Error error, {required PermissionStatus permissionStatus})
Error from the device
const

Properties

hashCode int
The hash code for this object.
no setteroverride
isError bool
True if the result is an error
no setter
isSuccess bool
True if the result is a success
no setter
locationOrEmpty Location
Returns the location if it's successful, or an empty location if it's an error.
no setter
permissionStatus PermissionStatus
The permission status of the location permission if the device sent it
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

errorOrEmpty() Error
Allows you to access the error if it is an error or a None error
locationOr(Location onError(Error error)) Location
Allows you to access the location if it is successful or to replace the location with a different value based on an error
match<T>({required T onSuccess(Location location), required T onError(Error error)}) → T
Allows you to access the location if it is successful or the error if it is not
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Constants

unknownError → const LocationResult
Represents an unknown location result with an error