From c72c7e3f07f00234e2d910db629af9377dda4ece Mon Sep 17 00:00:00 2001 From: bilalasd Date: Thu, 30 Jan 2020 09:26:27 -0600 Subject: [PATCH] Update README.md (#35) Changed the order for the three examples given to match the order in which they are described above. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c31d937..e935d85 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,14 @@ Geolocation offers three methods: https://pub.dartlang.org/documentation/geolocation/0.2.1/geolocation/Geolocation/currentLocation.html ```dart +// get last known location, which is a future rather than a stream (best for android) +LocationResult result = await Geolocation.lastKnownLocation(); + +// force a single location update (best for ios) +StreamSubscription subscription = Geolocation.currentLocation(accuracy: LocationAccuracy.best).listen((result) { + // todo with result +}); + // best option for most cases StreamSubscription subscription = Geolocation.currentLocation(accuracy: LocationAccuracy.best).listen((result) { if(result.isSuccessful) { @@ -158,14 +166,6 @@ StreamSubscription subscription = Geolocation.currentLocation(ac // todo with result } }); - -// force a single location update -StreamSubscription subscription = Geolocation.currentLocation(accuracy: LocationAccuracy.best).listen((result) { - // todo with result -}); - -// get last known location, which is a future rather than a stream -LocationResult result = await Geolocation.lastKnownLocation(); ``` ### Continuous location updates