Live

Weather Forecast Application

A cross-platform weather application built with Flutter and the OpenWeather API. City search returns current conditions and forecasts with temperature, humidity and wind, built as a focused exercise in consuming a third-party REST API cleanly and handling its failure modes honestly.

Role
Sole developer.
Year
2023
Stack
Flutter, OpenWeather API, Dart, REST API

The problem

Weather apps look trivial and are not, because almost all the difficulty is in the unhappy paths: the API is unreachable, the city is ambiguous, the response is missing fields, the user has no connection. A version that only handles the successful response is a demo, not an app.

How it was built

01A typed layer over the API response

Responses are parsed into typed Dart models rather than read as untyped maps throughout the UI. Passing raw JSON into widgets means every access is a potential null crash discovered by a user; parsing once at the boundary makes missing fields a handled case.

02Explicit state for every outcome

Loading, success, empty result and error are distinct states with distinct interfaces. The common failure is conflating error with empty, so a network failure renders as 'no results' and the user retries a search that was never the problem.

03Search that tolerates real input

City lookup handles ambiguous and misspelled names by showing candidates rather than silently picking the first match, which is how you end up showing the weather for the wrong continent.

Stack decisions

Why each piece was chosen, rather than just what was used.

Flutter

One codebase for Android, iOS and web on a UI-driven app where behaviour is identical across platforms.

OpenWeather API

Well-documented REST endpoints with a usable free tier, making it a good subject for practising clean API-consumption patterns.

Dart models

Parsing at the boundary turns a class of runtime null errors into compile-time and parse-time problems.

What it does

  • City search with candidate disambiguation
  • Current conditions and multi-day forecast
  • Temperature, humidity and wind detail
  • Distinct loading, empty and error states
  • Responsive layout across mobile and web

Questions this raises

What is the most common mistake when consuming a REST API in Flutter?

Passing raw JSON maps into the widget tree. Every field access then becomes a possible null crash found by a user rather than by the compiler. Parse into typed models once at the boundary, and treat error and empty as separate states — conflating them makes a network failure look like a search with no results.

Related work

Building something similar?

Naman Gundaniya takes on full stack and AI projects like this one. Available for hire, replies within 24 hours.