I want to show CircularProgressIndicator
until the function end, So I use this method,
-
set bool isLoading = false;
-
and this is the function,
verifyPhoneNumber(String input) async { setState(() { isLoading = true; }); await AuthMethods().phoneSign(context, input); setState(() { isLoading = false; });}
-
For this screen
Scaffold( body: isLoading ? Center( child: CircularProgressIndicator(color: darkblueColor), ) : Column( children: [ IntlPhoneField( onChanged: (phone) { setState(() { fullNumber = phone.completeNumber; }); }, ), CustomButton( onTap: () { verifyPhoneNumber(fullNumber); }, text: "Next", height: 50, ),],),)
This is not working!. Can futureBuilder
apply for this & If it’s yes, How?
this function work for firebase phoneAuth, There is phoneSign
inside AuthMethods
class.
2
Answers
Follow the docs, you already answered your Q. Also I am not sure what is your process but
StreamBuilder
also could be an option.You make a call
Then you do as the docs say and do something like this
For question snippet , you need to await for
verifyPhoneNumber
Make the async method