How najat-ttt/sams_basic works
Project Type and Purpose
• This is a full-stack, cross-platform mobile application (“SAMS”) built in Flutter (Dart) targeting Android, iOS, Web, Windows, Linux, and macOS.
• It uses Firebase as its backend (Authentication & Firestore) and several on-device plugins for local storage and file export.
• Purpose: enable teachers to log in, mark and review student attendance, and export attendance data as CSV/PDF.
High-Level Architecture Components
a. Client (Flutter UI)
• Entry point: lib/main.dart
• Pages: login_page (login, signup, forgot_password), profile_page (dashboard, attendance, reports, schedule, attendance statistics)
• Presentation layer: Widgets, routing, UI state management (setState/BLoC/Cubit if used)
b. Service Layer
• FirebaseAuthService: handles sign-in, sign-up, password reset via Firebase Authentication SDK
• FirestoreService: CRUD operations for attendance records, user profiles, courses
• LocalStorageService: shared_preferences for caching simple key-value data (e.g., auth tokens, user prefs)
• ExportService: pdf and excel packages to generate reports, open_file & path_provider to save/open file on device
• ImageService: image_picker plugin for any profile images or attachments
c. External Backend Services
• Firebase Authentication (user management)
• Firebase Firestore (NoSQL cloud database for attendance, course, user data)
d. Platform Embedding & Plugins
• Android (android/…), iOS (ios/…), Web (web/…), macOS, Linux, Windows folders: Flutter engine integration, native C++/Swift/Kotlin code
• Generated plugin registrants and platform channels for image_picker, pdf, excel, open_file, path_provider
Relationships and Data Flow
• Flutter UI → calls Service Layer (Dart classes) → SDK interface → Firebase (Auth or Firestore)
• On login: UI invokes FirebaseAuthService.signIn() → Firebase Auth → returns user credentials → cached in shared_preferences
• On attendance mark/fetch: UI invokes FirestoreService.[get/put] → Firestore
• On export: UI invokes ExportService → uses pdf/excel libs → writes file via path_provider → opens via open_file
Architectural Patterns and Design Principles
• Layered architecture: Presentation (Widgets) → Domain/Services (business logic) → Data (Firebase & local storage)
• Single Responsibility: separate service classes for Auth, Firestore, Export, LocalStorage, Image handling
• Dependency Injection: if used (e.g., Provider, GetIt) to supply services to the UI
• Flutter plugin pattern: platform-specific code isolated in android/, ios/, etc.
• Top row: Platforms (Android, iOS, Web, macOS, Linux, Windows) feeding into Flutter engine
• Right side: External cloud services (Auth, Firestore)
• Bottom: Device Storage (shared_preferences, local filesystem)