geoPointFromPosition function

Future<GeoPoint> geoPointFromPosition(
  1. {@required Position position,
  2. String name,
  3. bool withAddress = false,
  4. LocationAccuracy locationAccuracy = LocationAccuracy.best,
  5. bool verbose = false}
)

Returns a GeoPoint from a given position

Implementation

Future<GeoPoint> geoPointFromPosition(
    {@required Position position,
    String name,
    bool withAddress = false,
    LocationAccuracy locationAccuracy = LocationAccuracy.best,
    bool verbose = false}) async {
  if (verbose) {
    print("Creating geopoint from position $position");
  }
  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);
}