In this section, you’ll create a custom stateful widget.
You’ll replace two stateless widgets—the solid red
star and the numeric count next to it—with a single
custom stateful widget that manages a row with two
children widgets: an IconButton and Text.

Implementing a custom stateful widget requires creating two classes:

A subclass of StatefulWidget that defines the widget.

A subclass of State that contains the state for that
widget and defines the widget’s build() method.

This section shows you how to build a stateful widget,
called FavoriteWidget, for the lakes app.
After setting up, your first step is choosing how state is
managed for FavoriteWidget.

Step 0: Get ready

If you’ve already built the app in the
building layouts tutorial (step 6),
skip to the next section.

Make sure you’ve set up your environment.

Create a new Flutter app.