How m-khallouf/toolshare works
Project type and purpose
• Project type: Cross-platform mobile/web/desktop app built with Flutter (Dart).
• Purpose: A peer-to-peer tool-sharing marketplace. Users list, search, filter, borrow, or lend tools. Includes real-time chat, authentication, and offers.
File structure
• Top-level Flutter modules:
– android/, ios/, web/, linux/, macos/, windows/: platform folders generated by Flutter.
– lib/: the Dart application code.
– test/: widget tests.
– screens/: UI pages (home, chat, login/signup, profile, settings).
– services/: business logic & data access (authentication, chat, offers, security).
– models/: data classes (e.g. Message).
– widget/: reusable UI components.
– themes/: light/dark theme management.
– utilities/: barrel export files.
• Config files: pubspec.yaml (dependencies), firebase.json + lib/firebase_options.dart (Firebase setup).
README for additional insights
• Backend: Firebase (Auth, Firestore/Real-Time DB).
• Key features: tool search/filter, listing management, chat messaging, authentication.
• No custom servers—entirely client + Firebase.
Main components and interactions
a. Components
1. Client App (Flutter)
– UI Layer (screens/, widget/)
– State & Theme Layer (theme_provider)
– Service Layer (services/)
– Data Models (models/)
2. Firebase Backend
– Authentication (Email/Password, Social Login)
– Firestore Database (tools collection, offers, chat rooms, messages)
– Cloud Storage (tool images, user profile pictures)
– Optional Cloud Functions (validation, notifications)
3. Third-party Services
– OAuth providers (Google, Facebook, etc.)
– Push Notifications (FCM)
b. Relationships
• UI → calls Service Layer APIs → read/write Firestore or Auth.
• Auth-Gate widget listens to Auth state changes → UI routing (login vs. home).
• Chat screens subscribe to Firestore “messages” collection for real-time updates.
• Offer submissions write to Firestore “offers” collection.
• Profile changes update Firestore user document + possibly Storage.
• ThemeProvider broadcasts theme changes to UI.
c. Architectural patterns
• Layered architecture: UI → Services → Data
• Dependency Injection in services/security/injections.dart
• MVVM-like separation: Screens (View) bind to Services (ViewModel) using Providers.
• Real-time event-driven flows via Firestore streams.
d. Key technologies
• Flutter & Dart
• Firebase (Auth, Firestore, Storage, Functions)
• Provider or similar state-management for DI & theming
• Platform channels auto-generated by Flutter for Android, iOS, desktop targets
Final advice
• Platform folders (android/, ios/, web/) in a small “Generated by Flutter” section—these aren’t hand-written but show target outputs.