How atharvaingle/smart-grow works
Purpose and Runtime
Smart Grow/Farmassist is a Flutter mobile application for authenticated farm management, IoT telemetry monitoring, and on-device plant disease classification. Android and iOS hosts bootstrap Flutter; web scaffolding is also present. The TensorFlow Lite model is bundled at model.tflite.
Application Shell and Navigation
The UI is organized by feature under ui/, with the home shell and bottom navigation selecting major workflows. Key entry-facing paths are ui/home_page.dart, ui/bottom_navigation_bar/bottom_navigation_bar.dart, and platform launchers android/app/src/main/kotlin/com/example/farmassist/MainActivity.kt and ios/Runner/AppDelegate.swift.
Identity and User Boundary
Authentication uses Firebase Authentication with Bloc/Cubit state transitions for session, login, and signup. User profile records are handled separately through user repositories, forming the boundary between Firebase identity and app-owned user data in Cloud Firestore.
• bloc/authentication/bloc/authentication_bloc.dart
• bloc/login/login_cubit.dart
• data/authentication/repositories/authentication_repository.dart
• data/user/repositories/user_repository.dart
Farm Management and External Content
Planting and harvesting screens write/read user-scoped farm records through repositories, intended for Cloud Firestore. Farm views also compose weather forecasts and science news from external HTTP APIs; these are independent service boundaries rather than local domain state.
• ui/farm/farm_management_page.dart
• data/farm/repositories/storeData.dart
• data/farm/repositories/harvest_storeData.dart
• data/farm/api/openweathermap_weather_api.dart
• data/farm/resources/newsAPI.dart
IoT Telemetry Pipeline
The app reads per-user telemetry from Firebase Realtime Database via the telemetry repository, converts it into domain/chart models, and renders current readings and time-series charts. The upstream producer is an external IoT simulator/device. Alert evaluation and push delivery occur outside this repo: Realtime Database writes trigger Firebase Cloud Functions, which use Firebase Cloud Messaging.
• data/IoT/repositories/telemetry_data_repository.dart
• data/IoT/models/telemetry_data.dart
• ui/IoT/IoT_monitoring_page.dart
• ui/IoT/telemetry_data_chart.dart
Disease Detection Pipeline
Users capture/select plant imagery through the disease-detection UI. Classification code loads and executes the local TFLite model, returning one of the trained disease categories for presentation in diagnostic cards/views. Model inference is on-device; model training was externalized to Google Cloud AutoML Vision.
• ui/diseases/disease_detection_page.dart
• ui/diseases/diagnosis.dart
• data/diseases/classifier.dart
• data/diseases/disease_detection_model.dart
• model.tflite
State and Data Architecture
The repository mixes feature-local presentation state (Bloc/Cubit in authentication and news) with repository/service-based data access for Firebase and HTTP integrations. Domain models isolate UI from serialized backend/API data, notably weather, farm records, news, and telemetry.
• ui/farm/news/bloc/nBloc.dart
• data/farm/services/forecast_service.dart
• data/farm/models/Planting.dart
• data/farm/models/Weather.dart
• data/IoT/models/line_chart_spots.dart
Components 23
Flutter Mobile App
- Android / iOS Hosts · Bootstraps the Flutter runtime.
android/app/src/main/kotlin/com/example/farmassist/MainActivity.kt - Home Shell
ui/home_page.dart - Bottom Navigation
ui/bottom_navigation_bar/bottom_navigation_bar.dart - Auth Bloc / Login Cubit
bloc/authentication/bloc/authentication_bloc.dart - Authentication Repository
data/authentication/repositories/authentication_repository.dart - User Repository · Separates app-owned profiles from Firebase identity.
data/user/repositories/user_repository.dart - Farm Management
ui/farm/farm_management_page.dart - Planting / Harvest Repositories
data/farm/repositories/storeData.dart - Forecast Service
data/farm/services/forecast_service.dart - News Bloc
ui/farm/news/bloc/nBloc.dart - IoT Monitoring
ui/IoT/IoT_monitoring_page.dart - Telemetry Repository
data/IoT/repositories/telemetry_data_repository.dart - Telemetry / Chart Models · Converts database readings for current values and chart series.
data/IoT/models/telemetry_data.dart - Disease Detection UI
ui/diseases/disease_detection_page.dart
Firebase
- Firebase Authentication
- Cloud Firestore
- Realtime Database
- Cloud Functions + FCM · Evaluates telemetry-triggered alerts outside this repository.
External Services
- IoT Device / Simulator
- OpenWeather API
- Science News API
On-device ML
- TFLite Classifier
data/diseases/classifier.dart - Disease Model · Bundled trained disease-category model.
model.tflite
Connections 22
- Android / iOS Hosts → Home Shell: launches
- Home Shell → Bottom Navigation: uses
- Bottom Navigation → Farm Management: selects
- Bottom Navigation → IoT Monitoring: selects
- Bottom Navigation → Disease Detection UI: selects
- Auth Bloc / Login Cubit → Authentication Repository: authenticates through
- Authentication Repository → Firebase Authentication: uses
- User Repository → Cloud Firestore: reads/writes profiles
- Farm Management → Planting / Harvest Repositories: manages records through
- Planting / Harvest Repositories → Cloud Firestore: reads/writes farm records
- Farm Management → Forecast Service: shows forecast
- Forecast Service → OpenWeather API: requests
- News Bloc → Science News API: fetches
- IoT Monitoring → Telemetry Repository: loads telemetry
- Telemetry Repository → Realtime Database: reads per-user data
- Telemetry Repository → Telemetry / Chart Models: maps to
- Telemetry / Chart Models → IoT Monitoring: renders readings and charts
- IoT Device / Simulator → Realtime Database: writes telemetry
- Realtime Database → Cloud Functions + FCM: triggers alerts
- Disease Detection UI → TFLite Classifier: submits image
- TFLite Classifier → Disease Model: loads and executes
- TFLite Classifier → Disease Detection UI: returns diagnosis