Skip to content
pubscout

location_web

7.0.1, released 2 weeks ago by bernos.dev

Web implementation of the location plugin for Flutter web.

$ flutter pub add location_web
Source repository

What it does

Provides geolocation support on web by wrapping the browser Geolocation API. It exposes the same API as the main location package, but only works on web.

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

Use it when

  • You need location data in a Flutter web app
  • You already depend on the location package and want the web implementation automatically added

Skip it when

  • You target mobile or desktop platforms that require native location plugins
  • You need advanced geofencing or background location updates

Strengths

  • Automatically added when depending on location
  • Handles permission and error mapping to PlatformException
  • Bug fixes for NaN heading and permission handling

Weaknesses

  • Web only, no support for iOS/Android/desktop
  • Requires browsers that support Geolocation API

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
3

Add location: ^7.0.0 to pubspec; no extra permissions needed beyond browser prompts

import 'package:location/location.dart';

final location = Location();

Future<void> getLocation() async {
  final locData = await location.getLocation();
  print('Lat: ${locData.latitude}, Lng: ${locData.longitude}');
}

Alternatives

Packages that do the same job and could replace location_web.

Works with

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