Skip to content

Repository files navigation

Weather App

A Flutter weather app that shows current conditions and an hourly forecast using the OpenWeather API.

Features

  • Current temperature, sky condition and weather icon
  • Scrollable hourly forecast
  • Humidity, wind speed and pressure
  • Pull-to-refresh via the toolbar refresh button
  • Loading and error states

Requirements

  • Flutter SDK 3.10.8 or newer
  • Android Studio or VS Code with the Flutter extension
  • An Android emulator or a physical device
  • A free OpenWeather API key

Setup

  1. Install dependencies:
flutter pub get
  1. Create your secrets file by copying the example:
cp lib/secrets.example.dart lib/secrets.dart
  1. Get a free API key from https://openweathermap.org/api and paste it into lib/secrets.dart:
const openWeatherAPIKey ='your key here';

A new key can take up to two hours to activate. Until then requests return 401.

  1. Run the app:
flutter run

Project structure

lib/
main.dart App entry point and theme
weather_screen.dart Main screen, API call and layout
hourly_forecast_item.dart Single forecast card
additional_info_item.dart Single info tile
secrets.dart API key (not committed)

Notes

  • lib/secrets.dart is listed in .gitignore. Never commit a real API key.
  • The city is hardcoded to London in weather_screen.dart. Change cityName to use a different one.
  • Temperatures are shown in Kelvin, which is what the API returns by default.
  • Only the Android platform is configured.

Dependencies

  • http for API requests
  • intl for date formatting

About

WeatherApp demo presented in App Dev Workshop

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages