geo_selector 0.0.1 copy "geo_selector: ^0.0.1" to clipboard
geo_selector: ^0.0.1 copied to clipboard

A Flutter package for picking, searching, and selecting locations using OpenStreetMap with address details.

geo_selector #

A Flutter package that provides a simple and customizable location picker using OpenStreetMap with the flutter_map plugin.
It allows users to search, select, and confirm a location, with reverse geocoding support to display human-readable addresses.


โœจ Features #

  • ๐Ÿ“ Select any location on the map with a tap
  • ๐Ÿ” Search for places by address or name (OpenStreetMap Nominatim API)
  • ๐ŸŽฏ "My Location" button to quickly jump to userโ€™s current position
  • ๐Ÿ™๏ธ Fallback default location (New Delhi, India) if GPS is unavailable
  • ๐Ÿ  Shows selected locationโ€™s address
  • ๐Ÿ”— Returns a LocationResult object with latitude, longitude, and address

๐Ÿ“ธ Screenshot #

(Add your package screenshot here)


๐Ÿš€ Installation #

Add dependency in pubspec.yaml:

dependencies:
  location_selector: ^0.0.1
Run:
flutter pub get
๐Ÿ“ฆ Usage
import 'package:flutter/material.dart';
import 'package:latlong2/latlong.dart';
import 'package:location_selector/location_selector.dart';
import 'package:location_selector/location_result.dart';

class LocationPickerExample extends StatelessWidget {
  const LocationPickerExample({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Select Location")),
      body: LocationSelector(
        onLocationSelected: (LocationResult result) {
          debugPrint("Selected Location: "
              "Lat: ${result.latitude}, Lng: ${result.longitude}, Address: ${result.address}");
        },
      ),
    );
  }
}
๐Ÿ“‚ API Reference
LocationSelector Widget
Property	Type	Default	Description
initialLocation	LatLng?	New Delhi	Initial map position if GPS not found
enableMyLocation	bool	true	Show floating "My Location" button
showAddress	bool	true	Whether to display the selected address
onLocationSelected	Function(LocationResult)	required	Callback when user selects a location
LocationResult Model
class LocationResult {
  final double latitude;
  final double longitude;
  final String? address;
}
๐ŸŒ How It Works
Loads userโ€™s current GPS location (falls back to New Delhi if unavailable)
Lets the user tap anywhere on the map to select a location
Uses OpenStreetMap Nominatim API for reverse geocoding
Provides a search bar for address/place search
โšก Dependencies
flutter_map
latlong2
location
http
0
likes
130
points
44
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for picking, searching, and selecting locations using OpenStreetMap with address details.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_map, geocoding, http, latlong2, location

More

Packages that depend on geo_selector