Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
android
ios
lib
test
README.md
pubspec.lock
pubspec.yaml

README.md

project05 - The fifth knockdown 👊

Stateful Widgets in Flutter

This app focuses on making a Stateful Widget by implementing a counter by these steps:

project04 > lib > src > app.dart

  1. class StateKeeper extends State<App> We change the class name from App to StateKeeper and extend it to the State class which is used to update only that specific state of the app UI which needs updation (in this case, it's the Text). Inside the angular brackets we pass in the class which extends our StatefulWidget.

  2. body: Text('$counter') Inside the body property of Scaffold we assign a Text widget which takes in the variable counter as a String (therefore it's $counter and not counter).

  3. setState((){}) The setState is a callback method which tells Flutter that the state of the object has to be changed, i.e. our text should change and as it's a child of onPressed(), it means that this will be called whenever our FAB is pressed.