This project shows a demo for an online fruit juice order business
Fresh.Go.Demo.mp4
The following packages are used in this project:
Package description: The cloud_firestore package provides a Flutter plugin that allows communication with the Cloud Firestore database service provided by Firebase. It enables developers to store, retrieve, and sync data in real-time across multiple devices and platforms.
Usage:
dependencies:
cloud_firestore: ^version_numberPackage description: The get_it package is a simple service locator for Dart and Flutter projects. It allows for the easy management of dependency injection and provides a way to locate and retrieve instances of registered services or objects.
Usage:
dependencies:
get_it: ^version_number-
Clone the repository:
git clone https://github.com/preciousbata/FreshandGo.git
-
Change to the project directory:
cd project_directory -
Install the required packages:
flutter pub get
-
Obtain the necessary credentials for Firebase Cloud Firestore and set up your project on the Firebase console.
-
Configure the Firebase SDK in your Flutter project by following the official Firebase documentation.
-
Add the Firebase configuration file to your project's
android/app/andios/Runner/directories as mentioned in the Firebase setup instructions.
-
Import the necessary packages in your Dart files:
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:get_it/get_it.dart';
-
Set up the
cloud_firestoreplugin and initialize the Firebase app:void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); }
-
Use
get_itpackage to register and retrieve services or objects:// Register a service GetIt locator = GetIt.instance; locator.registerSingleton<MyService>(MyService()); // Retrieve a service MyService service = locator<MyService>();
-
Utilize the
cloud_firestorepackage to interact with the Cloud Firestore database:// Retrieve a Firestore collection CollectionReference usersRef = FirebaseFirestore.instance.collection('users'); // Add a document to the collection usersRef.add({'name': 'John Doe', 'age': 30}); // Query documents from the collection QuerySnapshot snapshot = await usersRef.get(); // Iterate over the documents for (QueryDocumentSnapshot doc in snapshot.docs) { print(doc.data()); }
Contributions are welcome! If you encounter any issues or would like to suggest improvements, please create a new issue or submit a pull request.
This project is licensed under the MIT License.