v10.2.0location
Plattformübergreifender Plugin für den einfachen Zugriff auf die Echtzeitstandortdaten des Geräts.
Ein Flutter-Plugin zur einfachen Verwaltung von Echtzeitstandorten unter Android, iOS, macOS, Web, Windows und Linux. Bietet Einstellungen zur Leistungs- oder Batterieoptimierung.
Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.
The easiest way to get a device's location in real-time — on every platform Flutter runs.
One simple API for GPS coordinates, live location streams and background tracking on Android, iOS, macOS, Web, Windows and Linux.
📖 Documentation · 🌐 Live web demo · 📦 pub.dev · 💬 Feedback
await location.getLocation() and you're done.onLocationChanged for continuous updates.| Feature | Android | iOS | macOS | Web | Windows | Linux |
|---|---|---|---|---|---|---|
| One-time location | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Location stream | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Background updates | ✅ | ✅ | — | — | — | — |
| Permission handling | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Windows uses
Windows.Devices.Geolocation; Linux talks to GeoClue2 over D-Bus. Both require the system location service to be enabled.
Add the package:
dependencies:
location: ^10.0.0
Get a location:
import 'package:location/location.dart';
final location = Location();
// Make sure the service is on and permission is granted.
if (!await location.serviceEnabled() && !await location.requestService()) return;
if (await location.requestPermission() != PermissionStatus.granted) return;
// One-time fix…
final current = await location.getLocation();
print('${current.latitude}, ${current.longitude}');
// …or a live stream.
location.onLocationChanged.listen((loc) {
print('Moved to ${loc.latitude}, ${loc.longitude}');
});
That's it. Platform setup (permissions, background mode, sandbox entitlements) and the full API are covered in the package README and the documentation website.
| Package | Description | pub.dev |
|---|---|---|
location |
The plugin you use in your app. | |
location_platform_interface |
Shared platform interface. | |
location_web |
Web implementation. |
Issues and pull requests are very welcome — this plugin is community-maintained and we're always looking for help. Browse the open issues to get started, or open a new one to report a bug or request a feature.
Released under the MIT License. © 2017 Guillaume Bernos.
Abhängigkeiten 1 Einträge
^3.1.1Nach Anwendungsfall filtern, Aktivität vergleichen und vor der Nutzung das Originalprojekt prüfen.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗