location_reader 0.0.7 copy "location_reader: ^0.0.7" to clipboard
location_reader: ^0.0.7 copied to clipboard

A Flutter package for retrieving and handling location-related data, including current location, reverse geocoding, Firebase integration, location permission management, and nearby location queries.

location_reader #

location_reader is a Flutter package designed to simplify the process of retrieving and handling location-related data. It supports features such as obtaining the current location, converting coordinates to city names or country codes, managing location permissions, and performing nearby location queries with GeoFirePoint and Firebase.

Features #

  • 🌍 Get current location using Geolocator
  • πŸ™οΈ Convert latitude and longitude to city name and country code using geocoding
  • πŸ“ Retrieve GeoFirePoint objects for use in Firebase
  • πŸ“‘ Nearby location query support via geoflutterfire2
  • πŸ” Seamless location permission handling
  • πŸ’‘ Clean architecture with services, repositories, use cases, and cubits

Installation #

Add the following to your pubspec.yaml:

dependencies:
  location_reader: ^<latest_version>

Then run:

flutter pub get

Getting Started #

1. Register Dependencies #

Ensure you call the DI registration method before using the services:

registerLocationServiceGetItDi();

2. Use Cases #

You can access location-related use cases like this:

final getCurrentLocation = sl<GetCurrentLocation>();
final location = await getCurrentLocation();

3. UI Integration #

Use LocationPicker and CountryCodeLoader widgets:

LocationPicker(
  onTap: () => // pick location logic,
)
CountryCodeLoader(
  page: (code) => Text("Country: $code"),
)

Dependencies #

  • [geolocator]
  • [geocoding]
  • [geoflutterfire2]
  • [flutter_bloc]
  • [get_it]
  • [dartz]
  • [json_serializable]

Example Use Cases #

  • GetCityName
  • GetCountryCode
  • GetCurrentLocation

All of these use cases internally handle permissions, errors, and edge cases.

JSON Support #

The LocationModel class supports JSON serialization using json_serializable.

Error Handling #

Utilizes Either from dartz and custom IFailure/LocationError for structured error handling.

Contributing #

Feel free to open issues and contribute pull requests for enhancements or bug fixes.

License #

MIT License. See LICENSE file for details.

2
likes
130
points
292
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for retrieving and handling location-related data, including current location, reverse geocoding, Firebase integration, location permission management, and nearby location queries.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bloc, cloud_firestore, dartz, equatable, exception_type, firestore_db_impl, flutter, flutter_bloc, fluttertoast, geo_lat_lon, geocoding, geolocator, get_it_di_global_variable, i_tdd, json_annotation, navigation_without_context, provider

More

Packages that depend on location_reader