Skip to content

Commit

Permalink
started conversion of location service to changeNotifier class
Browse files Browse the repository at this point in the history
  • Loading branch information
ninest committed Apr 11, 2020
1 parent 387cb9c commit 9556fba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/services/location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:nextbussg/providers/location_perms.dart';

class LocationServices {
class LocationServices extends ChangeNotifier {

// converting it to changeNotifier class so location only has to be retreived once
Position _position = null;

static Future<Position> getLocation() async {

try {
Position position =
await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);
Expand Down

0 comments on commit 9556fba

Please sign in to comment.