getLocation method

dynamic getLocation()

Implementation

getLocation() {
  Geolocator.getLastKnownPosition().then((value) {
    mirrorFlyLog("Location", value.toString());
    if (value != null) {
      setLocation(LatLng(value.latitude, value.longitude));
    } else {
      throw "last known location null";
    }
  }).catchError((er) {
    mirrorFlyLog("Location", er.toString());
    Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best)
        .then((value) {
      // if (value != null) {
      setLocation(LatLng(value.latitude, value.longitude));
      // } else {
      //   throw "current location null";
      // }
    }).catchError((er) {});
  });
}