Flutter minimalist state management: Weather app

Suragch
10 min readOct 14, 2023

An additional example to clarify the process

original photo from Unsplash

This tutorial will walk you through making a basic weather app using the state management tools that are already built into Flutter. You’ll use a ValueNotifier to tell the UI when there’s a state change and a ValueListenableBuilder to rebuild the parts of the UI that have changed.

For background on the motivation and architectural principles, read Flutter State Management for Minimalists. Also check out the counter app tutorial for an even more basic example. This article will build on that by introducing how to handle the common use cases of making web requests and storing data locally. For that, you’ll use services and provide access to them with the GetIt package.

The weather app will contact a web API on startup and, depending on the response, either show an error screen or the current temperature and weather. There is also a button in the top right to switch the temperature between Celsius and Fahrenheit.

Let’s get started.

Creating the weather app

--

--

Suragch
Suragch

Written by Suragch

Flutter and Dart developer. Twitter: @suragch1, Email: suragch@suragch.dev

Responses (1)