A modern cross-platform weather application built with a Flutter frontend and a Python FastAPI backend.
This project demonstrates the development of a production-style application featuring responsive UI, REST API integration, MQTT communication, Cubit state management, feature-based architecture, and native Android plugin development.
- π User Authentication: Secure login and registration system using JWT.
- π€οΈ Real-time Weather Data: Current weather conditions and forecasts via OpenMeteo integration.
- π‘ Live Updates: Real-time data synchronization using the MQTT protocol.
- π Location Management: Save and manage multiple locations.
- π€ User Profile: Personalized user settings and saved places.
- π Network Monitoring: Real-time network connectivity status monitoring.
- π¦ Native Integration: Device flashlight control via a custom Android plugin.
- π± Responsive UI: Optimized for mobile, tablet, and web viewing.
This project consists of two main components, ensuring a clear separation of concerns:
- State Management: Uses
flutter_bloc(Cubit) for reactive state management. Business logic is strictly separated from the UI. - Architecture: Feature-Based Architecture combined with a shared
coremodule. - Dependency Injection: Implemented via
RepositoryProviderto keep the application loosely coupled.
- API: RESTful API built with the high-performance FastAPI framework.
- Database: SQLite database for persistent storage (managed via SQLAlchemy).
- Security: JWT authentication and bcrypt password hashing for secure user sessions.
| Category | Technologies |
|---|---|
| Frontend Framework | Flutter, Dart |
| State Management | flutter_bloc (Cubit) |
| Frontend Networking | http, mqtt_client, internet_connection_checker_plus |
| Native Integration | Kotlin, MethodChannel (flashlight_plugin) |
| Backend Framework | Python, FastAPI, Uvicorn |
| Backend DB & Auth | SQLAlchemy, PyJWT, passlib, bcrypt |
| External APIs | OpenMeteo SDK |
lib/
βββ core/
β βββ theme/ # App theming and colors
β βββ data/ # Shared data repositories
β βββ models/ # Data models
β βββ services/ # API, Network, and MQTT services
β βββ cubit/ # Global state management
β βββ widgets/ # Reusable UI components
β βββ utils/ # Utility functions and helpers
β
βββ features/
β βββ auth/ # Authentication feature (Login/Register)
β βββ home/ # Weather dashboard and main screen
β βββ profile/ # User profile and settings
β
βββ main.dart # App entry point
weather_backend/
βββ api/
β βββ weather_router.py # Weather data endpoints
β βββ auth_router.py # Authentication endpoints
βββ core/
β βββ security.py # JWT and security utilities
βββ services/
β βββ auth_service.py # Authentication logic
β βββ weather_service.py # Weather data processing
βββ repository/
β βββ database.py # Database configuration
β βββ user_repository.py # User database operations
βββ main.py # FastAPI app entry point
βββ requirements.txt # Python dependencies
βββ weather.db # SQLite database
- Flutter SDK 3.11.1 or higher
- Python 3.8+
- Android Studio / VS Code
Navigate to the backend directory and set up the Python environment:
cd weather_backend
# Create and activate virtual environment
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start the server
uvicorn main:app --reload
*The API will be available at http://localhost:8000*
*Swagger API documentation: http://localhost:8000/docs*
Open a new terminal, navigate to the project root, and run:
# Install Flutter dependencies
flutter pub get
# Run the app
flutter run
Note: During dependency installation, Flutter will automatically download the custom flashlight_plugin directly from GitHub.
The application contains a hidden feature demonstrating native platform integration via a custom Flutter plugin.
To activate it:
- Launch the application on a physical Android device or Emulator.
- Locate the blue cloud βοΈ icon in the Top Navigation Bar.
- Perform a long press on the icon.
- This invokes the custom
MethodChannelimplementation and toggles the device flashlight. (On unsupported platforms like Web or iOS, an informational dialog is displayed instead).
π Plugin Repository: Leskiv1/flashlight_plugin
This project was originally developed as part of a University Mobile Application Development course. Throughout the course, the application was progressively enhanced:
- Labs 1-3: Responsive UI development, custom design system, and routing.
- Labs 4-5: REST API integration and real-time MQTT communication.
- Lab 6: Complete architectural refactoring to 3-Tier Architecture, implementing Cubit state management and Dependency Injection.
- Lab 7: Native Android plugin development using
MethodChanneland safe platform handling (dart:fficoncepts).
π Acknowledgements & Course Materials: * Course Repository: DenysDoskochynskyi/IoT-flutter