A compact, location-based weather dashboard built with Flutter. It calculates coordinates from a student index, queries Open‑Meteo for current weather, and caches the last successful result for offline use.
- Project: ClimaTrack
- Language: Dart / Flutter
- Repo:
clima-track
- Index-based coordinate calculation (from a student index)
- Real-time weather from Open‑Meteo
- Offline caching with
shared_preferences - Clean Material UI with error handling and retry
- Displays the raw API request URL for verification
- Flutter 3.x+
- http, shared_preferences, intl (see
pubspec.yaml)
Prerequisites
- Flutter SDK (3.0 or higher)
- Android Studio or VS Code (recommended)
- Emulator or physical device for testing
Installation
- Clone the repo and enter the directory
git clone https://github.com/Kavindya-Kariyawasam/clima-track-flutter.git
cd clima-track- Install dependencies
flutter pub getRunning the app
# Run on default device (choose with -d)
flutter run
# Run on Chrome (web)
flutter run -d chrome
# List connected devices
flutter devices
# Build a release APK
flutter build apk --releaseTip: while flutter run is active, press r for hot reload (preserves state) and R for hot restart (resets state).
lib/
├── main.dart
├── models/
├── services/
├── utils/
├── widgets/
└── screens/
- Convert a student index (e.g.,
224174B) into latitude/longitude using a simple digit mapping. - Build the Open‑Meteo API URL with the calculated coordinates and
current_weather=true. - Fetch current weather and show on the UI; on success, cache the response for offline use.
Example conversion (illustrative):
lat = 5 + (22 / 10.0) = 7.2lon = 79 + (41 / 10.0) = 83.1
- Base:
https://api.open-meteo.com/v1/forecast - Query params:
latitude,longitude,current_weather=true
Response fields used: temperature (°C), wind speed, weather code (WMO)
Common commands
# Install/upgrade deps
flutter pub get
flutter pub upgrade
# Run (pick device with -d)
flutter run
# Clean and rebuild
flutter clean
flutter pub get
# Format, analyze, test
dart format .
flutter analyze
flutter test
# Verbose run for troubleshooting
flutter run -v
# Diagnose environment
flutter doctor -vTips
- Use
debugPrint()for long logs. - Use Flutter DevTools for widget inspection and performance profiling.
- On macOS, if CocoaPods issues occur:
cd ios && pod repo update && pod install. - If plugin registration problems appear, try
flutter cleanthenflutter pub getand rebuild.
- Run the app and fetch weather successfully.
- Toggle Airplane Mode on the device/emulator.
- Fetch again — cached data should be shown with a "CACHED" indicator.
- Commit
pubspec.lockfor apps to ensure consistent dependency versions across CI and developers. - This repo includes GitHub Actions workflows under
.github/workflows/for linting, analysis, PR checks, and APK builds.
- Weather data: Open‑Meteo
- Icons: Flutter Material icons