Location class
Class for handling terminal location information.
The acquisition is initiated by doing listen.
It monitors the data at each interval and calls notifyListeners if it has been updated.
LocationData is stored in value, so refer to it.
Terminate acquisition with unlisten.
端末の位置情報を取り扱うクラス。
listenを行うことで取得を開始します。
インターバルごとにデータを監視し更新されていればnotifyListenersを呼び出します。
valueにLocationDataが格納されるのでそこを参照してください。
unlistenで取得を終了します。
- Inheritance
-
- Object
- ChangeNotifier
- MasamuneControllerBase<
LocationData?, LocationMasamuneAdapter> - Location
Constructors
- Location({LocationMasamuneAdapter? adapter})
- Class for handling terminal location information.
Properties
- adapter → LocationMasamuneAdapter
-
TAdapter
to be used.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- initialized → bool
-
Returns
true
if initialized by executing initialize.no setter - listening → bool
-
Returns
true
if listen has already been executed.no setter - permitted → bool
-
If permission is granted by executing initialize, returns
true
.no setter - permittedBackground → bool
-
Returns
true
if initialize is executed and permissions for background are allowed.no setter - primaryAdapter → LocationMasamuneAdapter
-
Specifies the default
TAdapter
if adapter is Null.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → LocationData?
-
The current value of the object. When the value changes, the callbacks
registered with addListener will be invoked.
no setteroverride
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
initialize(
{Duration timeout = const Duration(seconds: 60)}) → Future< void> - Initialization.
-
listen(
{LocationAccuracy? accuracy, double? distanceFilterMeters, Duration updateInterval = const Duration(seconds: 1), Duration timeout = const Duration(seconds: 60)}) → Future< void> - Starts acquiring location information.
-
load(
{Duration timeout = const Duration(seconds: 60)}) → Future< void> - If location information has not been acquired, location information is acquired only once.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
reload(
{Duration timeout = const Duration(seconds: 60)}) → Future< void> - Update location information.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
requestPermission(
{Duration timeout = const Duration(seconds: 60)}) → Future< bool> - Allow location permissions.
-
setValueInternal(
LocationData? value) → void -
Set method is used to update the current state.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unlisten(
) → Future< void> - Cancel acquisition of LocationData.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- query → const _$LocationQuery
- Query for Location.