Stateful Widget In Action

In this lesson, we cover how to implement a Stateful widget in detail.

Introduction

In this lesson, we’ll make use of the Stateful widget to toggle “Hello Flutter !” text from English to Spanish and vice versa.

We chose the Stateful widget because we need to update the currently displayed text.

In the Hello Flutter app, clicking on the ‘refresh’ IconButton in appBar will trigger updating the text. The interface rebuild is triggered by the setState method provided by the Stateful widget.

Get hands-on with 1200+ tech skills courses.