Skip to content

Commit

Permalink
Update README.md (#35)
Browse files Browse the repository at this point in the history
Changed the order for the three examples given to match the order in which they are described above.
  • Loading branch information
bilalasd authored Jan 30, 2020
1 parent 6799e47 commit c72c7e3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,21 @@ 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<LocationResult> subscription = Geolocation.currentLocation(accuracy: LocationAccuracy.best).listen((result) {
// todo with result
});
// best option for most cases
StreamSubscription<LocationResult> subscription = Geolocation.currentLocation(accuracy: LocationAccuracy.best).listen((result) {
if(result.isSuccessful) {
Double latitude = result.location.latitude;
// todo with result
}
});
// force a single location update
StreamSubscription<LocationResult> 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
Expand Down

0 comments on commit c72c7e3

Please sign in to comment.