Skip to content

Commit 9556fba

Browse files
committed
started conversion of location service to changeNotifier class
1 parent 387cb9c commit 9556fba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/services/location.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ import 'package:flutter/material.dart';
33
import 'package:geolocator/geolocator.dart';
44
import 'package:nextbussg/providers/location_perms.dart';
55

6-
class LocationServices {
6+
class LocationServices extends ChangeNotifier {
7+
8+
// converting it to changeNotifier class so location only has to be retreived once
9+
Position _position = null;
10+
711
static Future<Position> getLocation() async {
12+
813
try {
914
Position position =
1015
await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);

0 commit comments

Comments
 (0)