Viewing version 0.1.1. Open the latest package page.

geoclue

0.1.1

GeoClue: The Geolocation Service

Download archive

Readme

GeoClue for Dart

CI codecov

GeoClue: The Geolocation Service

Geoclue is a D-Bus service that provides location information. It utilizes many sources to best find user's location:

  • WiFi-based geolocation via Mozilla Location Service (accuracy: in meters)
  • GPS(A) receivers (accuracy: in centimeters)
  • GPS of other devices on the local network, e.g smartphones (accuracy: in centimeters)
  • 3G modems (accuracy: in kilometers, unless modem has GPS)
  • GeoIP (accuracy: city-level)
import 'dart:async';

import 'package:geoclue/geoclue.dart';

Future<void> main() async {
  final location = await GeoClue.getLocation(desktopId: '<desktop-id>');
  print('Current location: $location');

  print('Waiting 10s for location updates...');
  late final StreamSubscription sub;
  sub = GeoClue.getLocationUpdates(desktopId: '<desktop-id>')
      .timeout(const Duration(seconds: 10), onTimeout: (_) => sub.cancel())
      .listen((location) {
    print('... $location');
  });
}

Contributing to geoclue.dart

We welcome contributions! See the contribution guide for more details.

Changelog

0.1.1

  • Fix GeoClue.getLocationUpdates()

0.1.0

  • Initial version.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'geoclue:0.1.1'
pubspec.yaml
name: geoclue
description: "GeoClue: The Geolocation Service"
homepage: https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home
repository: https://github.com/canonical/geoclue.dart
issue_tracker: https://github.com/canonical/geoclue.dart/issues
version: 0.1.1

environment:
  sdk: '>=2.16.0 <3.0.0'

platforms:
  linux:

dependencies:
  dbus: ^0.7.3
  meta: ^1.7.0

dev_dependencies:
  build_runner: ^2.1.8
  lints: ^2.0.0
  mockito: 5.3.2
  test: ^1.16.0

Version history

VersionPublishedArchiveSHA-256
0.1.0On demandDownload52067499…527a9e
0.1.1Cached · Upstream SHA-256 matchedDownloadc2a998c7…bd2a7f

Dependencies

dbus "^0.7.3"

meta "^1.7.0"