A simple and modern Flutter weather application that fetches real-time weather data using the Open-Meteo API.
The app supports dark/light mode, offline detection, persistent login using SharedPreferences, and displays weather information such as temperature, humidity, and wind speed.
✅ Weather Fetching
- Fetches live weather data (temperature, humidity, wind speed, weather condition) from the Open-Meteo API.
- Calculates latitude and longitude automatically based on the user’s index number.
✅ Persistent Login
- Uses
SharedPreferencesto store the user’s index number and last fetched weather data.
✅ Dark / Light Theme
- Dynamically toggled using the
Providerpackage (ThemeProvider).
✅ Offline Detection
- Uses
connectivity_plusto check network connectivity. - Shows a red MaterialBanner when offline.
- Prevents API calls when disconnected.
✅ Error Handling
- Displays friendly “Error fetching weather” message on failures.
- Prevents crashes when offline or data is missing.
✅ Clean UI
- Uses modern UI styling with Google Fonts (Poppins) for text.
- Displays weather info in neat info cards.
-
On first launch, the user enters their index number.
-
The app calculates:
latitude = 5 + (firstTwoDigits / 10); longitude = 79 + (nextTwoDigits / 10);
-
Fetches data from the Open-Meteo API:
https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}¤t=temperature_2m,weather_code,wind_speed_10m,relative_humidity_2m -
Saves the data locally using
SharedPreferencesfor offline viewing. -
Provides a refresh button to get updated data instantly.
lib/
│
├── main.dart
│
├── screens/
│ ├── home/
│ │ ├── home_screen.dart
│ │ ├── utils/
│ │ │ ├── weather_model.dart
│ │ │ ├── weather_widgets.dart
│ │
│ ├── welcome_input_screen.dart
│
├── utils/
│ ├── theme_provider.dart
│ ├── custom_themes.dart
│
└── ...
| Package | Purpose |
|---|---|
http |
Fetch data from Open-Meteo API |
provider |
Manage app theme state |
shared_preferences |
Save index number and weather data locally |
connectivity_plus |
Detect offline/online status |
google_fonts |
Use custom fonts (Poppins) |
flutter/material.dart |
Core Flutter UI components |
git clone https://github.com/yourusername/flutter-weather-app.git
cd flutter-weather-appflutter pub getflutter runflutter build apk --releaseYou can find the APK at:
build/app/outputs/flutter-apk/app-release.apk
- Flutter SDK installed
- Android Studio or VS Code with Flutter extension
- USB debugging enabled on your phone
- Android SDK tools installed
- Connect your Android phone via USB
- Enable Developer Mode → USB Debugging
- Open VS Code and click Run → Start Debugging (F5)
- Select your device from the list
- Wait for the app to install and launch automatically
-
Build the release version:
flutter build apk --release
-
Copy
app-release.apkto your phone. -
Open the file and install manually.
| Light Mode | Dark Mode |
|---|---|
![]() |
![]() |
- 🌍 Add location picker for latitude & longitude
- ☁️ Display weather icons dynamically
- 🕒 Add caching duration (e.g., refresh every 30 minutes)
- 📅 Include 7-day weather forecast
This project is open-source and available under the MIT License.

