Skip to content

jugomo/meteo_alert

Repository files navigation

Meteo Alert

Flutter app that monitors weather forecasts and notifies when wind speed, temperature, or rain probability thresholds are about to be exceeded.

Features

  • Authentication — sign in with Firebase Auth; alerts are tied to the authenticated user.
  • Multiple alerts — each alert is displayed as an independent tab.
  • Configurable thresholds — enable or disable wind (km/h), temperature (°C), and rain probability (%) independently.
  • Hourly forecast — queries the Open-Meteo API and lists only the hours where a threshold is exceeded, grouped by day.
  • Automatic geocoding — city suggestions appear in real time while typing; coordinates are resolved before saving the alert.
  • Cloud persistence — alerts are stored in Firebase Realtime Database and synced across devices.
  • Local persistence — alerts are also cached in SharedPreferences and restored on next launch.
  • Pull-to-refresh — swipe down on the detail view to refresh the forecast.
  • Push notifications — a local notification is fired when any threshold will be exceeded in the next hour; platform-specific implementations for native and web.
  • Dark / light mode — theme preference toggled from the settings screen and persisted locally.
  • Settings screen — dark mode switch, sign-out action, and an About tab with app and API info.

Project structure

lib/
├── main.dart                        # Entry point (runApp only)
├── app.dart                         # MaterialApp + theme + ThemeNotifier wiring
├── firebase_options.dart            # Generated Firebase configuration
├── core/
│   ├── alert_checker.dart           # Checks forecasts and triggers local notifications
│   ├── notification_service.dart    # Conditional export (native / web)
│   ├── notification_service_native.dart  # flutter_local_notifications implementation
│   ├── notification_service_web.dart     # Web Notification API implementation
│   ├── theme_notifier.dart          # ValueNotifier<ThemeMode> with SharedPreferences
│   └── constants/
│       └── countries.dart           # Country list and ISO codes
├── data/
│   ├── models/
│   │   ├── alert.dart               # Alert model with JSON serialization
│   │   ├── forecast_hour.dart       # Forecast hour with exceeded values
│   │   └── city_suggestion.dart     # Geocoding suggestion
│   └── repositories/
│       ├── alert_repository.dart    # Persistence via SharedPreferences + Firebase RTDB
│       ├── auth_repository.dart     # Firebase Auth (sign in / sign out)
│       └── weather_repository.dart  # Open-Meteo API (forecast + geocoding)
└── presentation/
    ├── screens/
    │   ├── home_screen.dart         # Main screen with TabBar
    │   ├── settings_screen.dart     # Dark mode, sign out, About
    │   └── auth_screen.dart         # Login / registration screen
    └── widgets/
        ├── alert_detail_view.dart   # Forecast view per alert
        ├── create_alert_sheet.dart  # Bottom sheet to create/edit an alert
        ├── summary_chip.dart        # Threshold summary chip
        ├── hour_tile.dart           # Hourly row with exceeded values
        └── value_chip.dart          # Individual colored value chip

External APIs

Service Purpose
api.open-meteo.com/v1/forecast Hourly forecast (temperature, wind, rain)
geocoding-api.open-meteo.com/v1/search City autocomplete and geocoding

Both APIs are free and require no API key.

Main dependencies

Package Purpose
http Requests to Open-Meteo APIs
shared_preferences Local alert persistence and theme preference
firebase_core Firebase initialization
firebase_auth User authentication
firebase_database Cloud alert storage (Realtime Database)
flutter_local_notifications Local push notifications (native platforms)
web Web Notification API access (web platform)

Getting started

Prerequisites

  • Flutter 3.x / Dart 3.x
  • A Firebase project with Authentication (Email/Password) and Realtime Database enabled
  • FlutterFire CLI: dart pub global activate flutterfire_cli

Firebase setup

The following files are excluded from version control because they contain project credentials:

File Platform
android/app/google-services.json Android
ios/Runner/GoogleService-Info.plist iOS
macos/Runner/GoogleService-Info.plist macOS
lib/firebase_options.dart All (generated)

After cloning, run:

flutterfire configure --project=<your-firebase-project-id>

This generates lib/firebase_options.dart and places the platform config files in the right directories.

Run

flutter pub get
flutter run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors