Member-only story

Flutter — How to call functions between stateful widgets?

A tutorial on how to use the provider package in Flutter.

Flutter Developer
2 min readOct 25, 2021

--

Managing functions from provider will allow you to control functions from all pages.

If you change a variable you can call notifylistener() function inside your provider function. So that you can change state of widget.

I will try to explain it in a glance however this is an important subject of flutter.

Here is my folder structure

provider folder inside lib

At provider folder we define our provider classes.

Firstly i define class which extends changeNotifier class. This is what make this class provider.

Side note: notifyListener() function here calls setState of every widget if you use any variables inside that class and this is what you are searching for.

The provider class Auth that extends ChangeNotifier

Then i import it into my main.dart file or whatever file you want. Only condition is being above the widget that…

--

--

Flutter Developer
Flutter Developer

Written by Flutter Developer

Flutter and Native Android developer

No responses yet