location_crud_service 0.0.4 copy "location_crud_service: ^0.0.4" to clipboard
location_crud_service: ^0.0.4 copied to clipboard

A lightweight Dart service to update Firestore documents with the user's current location using GeoFirePoint, ideal for location-based Flutter apps.

location_crud_service #

A lightweight and extensible Dart package for updating user location data in Firebase Firestore using GeoFirePoint. This service is ideal for Flutter apps requiring geolocation tracking, real-time location updates, or location-based features with Firestore.

Features #

  • Update Firestore documents with current geolocation.
  • Uses GeoFirePoint format for location storage.
  • Built with clean architecture and dependency injection principles.

Getting Started #

Installation #

Add this to your pubspec.yaml:

dependencies:
  location_crud_service: <latest_version>

Then run:

flutter pub get

Prerequisites #

This package requires:

  • A Firestore service implementing IFireStoreDbService
  • A location provider implementing ILocationServiceGeoFirePointProvider

Register the Service #

Use dependency injection to register the service:

sl.registerLazySingleton<ILocationCrudService>(
  () => LocationCrudServiceGeoFirePointFireStoreDataSourceImpl(
    fireStoreDbService: sl(),
    iGeoFireLocationService: sl(),
  ),
);

Usage #

final locationService = sl<ILocationCrudService>();

final success = await locationService.updateLocation(
  id: "user_123",
  path: "users",
);

if (success) {
  print("Location updated successfully!");
} else {
  print("Failed to update location.");
}

API #

updateLocation #

Future<bool> updateLocation({
  required String id,
  required String path,
  String field = "position",
});

Updates the document at the specified path and ID with the current GeoFirePoint location.

Contributing #

Contributions are welcome! Please open issues or submit pull requests.

License #

MIT License. See LICENSE for details.

0
likes
150
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Dart service to update Firestore documents with the user's current location using GeoFirePoint, ideal for location-based Flutter apps.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

firestore_db_impl, flutter, geo_lat_lon, get_it_di_global_variable, i_tdd, location_reader, navigation_without_context

More

Packages that depend on location_crud_service