flutter_google_location_picker 0.0.6 copy "flutter_google_location_picker: ^0.0.6" to clipboard
flutter_google_location_picker: ^0.0.6 copied to clipboard

A flutter plugin helps to search or pick location picker from map. It is completely free and easy to use.

Flutter Google Location Picker #

A powerful, customizable, and completely free Flutter plugin to search and pick locations using OpenStreetMap (OSM) via flutter_map. Despite the name, this package provides a privacy-focused and cost-effective alternative to Google Maps API for location picking.

Pub Version License: MIT

Features #

  • 📍 Pick Location from Map: Interactive map interface to select precise coordinates.
  • 🔍 Search by Places: Integrated search functionality to find locations by name or address.
  • 🚀 Multi-platform Support: Works seamlessly on Android, iOS, Web, Windows, macOS, and Linux.
  • 🎨 Highly Customizable: Style your buttons, icons, and text to match your app's theme.
  • 🆓 Completely Free: Uses OpenStreetMap data, requiring no paid API keys.
  • 🛰️ Location Tracking: Option to automatically track and center on the user's current position.

Demo #

flutter_google_location_picker

Getting Started #

Add the dependency to your pubspec.yaml:

dependencies:
  flutter_google_location_picker: ^0.0.6

Import the package:

import 'package:flutter_google_location_picker/flutter_google_location_picker.dart';

Usage #

Basic Implementation #

Simply call the FlutterGoogleLocationPicker widget and provide a center point and an onPicked callback.

FlutterGoogleLocationPicker(
  center: LatLong(23.7662, 90.4255),
  onPicked: (pickedData) {
    print("Latitude: ${pickedData.latLong.latitude}");
    print("Longitude: ${pickedData.latLong.longitude}");
    print("Address: ${pickedData.displayName}");
  },
)

Advanced Implementation #

Customize the appearance and behavior with additional parameters.

FlutterGoogleLocationPicker(
  center: const LatLong(23.7662, 90.4255),
  initZoom: 11,
  minZoomLevel: 5,
  maxZoomLevel: 16,
  trackMyPosition: true,
  showZoomButtons: true,
  selectLocationButtonText: 'Set Location',
  selectLocationButtonStyle: ElevatedButton.styleFrom(
    backgroundColor: Colors.blue,
    foregroundColor: Colors.white,
  ),
  onPicked: (PickedData pickedData) {
    debugPrint("Picked: ${pickedData.latLong.latitude}, ${pickedData.latLong.longitude}");
    debugPrint("Address: ${pickedData.displayName}");
  },
  onChanged: (PickedData pickedData) {
    debugPrint("Map panned to: ${pickedData.latLong.latitude}, ${pickedData.latLong.longitude}");
  },
  onError: (error) => debugPrint("Error: $error"),
)

PickedData Properties #

When a location is picked, you receive a PickedData object with the following properties:

  • latLong: Contains latitude and longitude.
  • displayName: The formatted address or name of the location.
  • address: Detailed address components (if available).

Contribution #

Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

5
likes
160
points
119
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A flutter plugin helps to search or pick location picker from map. It is completely free and easy to use.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

connectivity_plus, flutter, flutter_map, flutter_map_location_marker, geolocator, geolocator_linux, http, intl, latlong2

More

Packages that depend on flutter_google_location_picker