We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 387cb9c commit 9556fbaCopy full SHA for 9556fba
1 file changed
lib/services/location.dart
@@ -3,8 +3,13 @@ import 'package:flutter/material.dart';
3
import 'package:geolocator/geolocator.dart';
4
import 'package:nextbussg/providers/location_perms.dart';
5
6
-class LocationServices {
+class LocationServices extends ChangeNotifier {
7
+
8
+ // converting it to changeNotifier class so location only has to be retreived once
9
+ Position _position = null;
10
11
static Future<Position> getLocation() async {
12
13
try {
14
Position position =
15
await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);
0 commit comments