getLocation static method

Future<GeoClueLocation> getLocation({
  1. GeoClueManager? manager,
  2. String? desktopId,
  3. GeoClueAccuracyLevel? accuracyLevel,
  4. int? distanceThreshold,
  5. int? timeThreshold,
})

Returns the current location or waits for a location update if unknown.

Implementation

static Future<GeoClueLocation> getLocation({
  GeoClueManager? manager,
  String? desktopId,
  GeoClueAccuracyLevel? accuracyLevel,
  int? distanceThreshold,
  int? timeThreshold,
}) async {
  final simple = _GeoClueSimple(manager);
  final client = await simple.start(
    desktopId: desktopId,
    accuracyLevel: accuracyLevel,
    distanceThreshold: distanceThreshold,
    timeThreshold: timeThreshold,
  );
  final location = client.location ?? await client.locationUpdated.first;
  await simple.stop(client);
  return location;
}