Skip to content
pubscout

geolocator

14.1.2, released 5 weeks ago by baseflow.com

Cross-platform plugin to access device GPS, location updates, and coordinate calculations.

Flutter FavoriteWASM-readyRock solid
$ flutter pub add geolocator
Source repository

What it does

Provides access to native location services across Android, iOS, macOS, Windows, Linux, and Web. Allows developers to check and request permissions, query current or last known positions, and stream continuous location updates. Also includes utility functions to calculate distance and bearing between coordinates.

AI-written summary of version 14.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need current GPS coordinates or continuous position tracking on mobile, desktop, or web.
  • You need built-in handling for location permissions and service status checks.
  • You need to calculate distance or bearing between geographic coordinates.

Skip it when

  • You only need address geocoding or reverse geocoding without raw GPS data (use the dedicated geocoding package instead).
  • You only need map rendering without location retrieval (use flutter_map directly).

Strengths

  • Comprehensive platform support covering Android, iOS, macOS, Windows, Linux, and Web.
  • Built-in permission handling and location service status queries.
  • Provides both one-off location queries and continuous stream updates.

Weaknesses

  • Extensive native configuration required, including Info.plist keys, manifest permissions, and background capability settings.
  • Web platform has limitations such as lack of support for last-known position and app settings navigation.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
6

Requires adding location permissions to AndroidManifest.xml (and background permissions if needed), adding usage descriptions to Info.plist on iOS/macOS, and configuring entitlements or Podfile bypass flags.

Future<Position> determinePosition() async {
  bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
  if (!serviceEnabled) {
    return Future.error('Location services are disabled.');
  }

  LocationPermission permission = await Geolocator.checkPermission();
  if (permission == LocationPermission.denied) {
    permission = await Geolocator.requestPermission();
    if (permission == LocationPermission.denied) {
      return Future.error('Location permissions are denied');
    }
  }

  if (permission == LocationPermission.deniedForever) {
    return Future.error('Location permissions are permanently denied.');
  }

  return await Geolocator.getCurrentPosition();
}

Alternatives

Packages that do the same job and could replace geolocator.

  • geocoding

    Pick geocoding when you only need to convert addresses to coordinates or vice versa, as geocoding features were separated from geolocator.

  • flutter_map

    Pick flutter_map when you need to render and interact with map tiles rather than just fetch GPS coordinates.

Works with

Packages commonly used together with geolocator: ones it builds on, ones built on it, and its own family.