geoPointFromLocation function

Future<GeoPoint> geoPointFromLocation(
  1. {bool withAddress = false,
  2. String name = "Current position",
  3. LocationAccuracy locationAccuracy = LocationAccuracy.best,
  4. bool verbose = false}
)

Returns a GeoPoint from the current position taken from Geolocator

Implementation

Future<GeoPoint> geoPointFromLocation(
    {bool withAddress = false,
    String name = "Current position",
    LocationAccuracy locationAccuracy = LocationAccuracy.best,
    bool verbose = false}) async {
  final position =
      await Geolocator().getCurrentPosition(desiredAccuracy: locationAccuracy);
  Placemark placemark;
  if (withAddress == true) {
    final placemarks = await Geolocator()
        .placemarkFromCoordinates(position.latitude, position.longitude);
    placemark = placemarks[0];
  }
  return _geoPointFromPosition(
      name: name, position: position, placemark: placemark, verbose: verbose);
}