Answers for "use provider inside initstate"

0

use provider inside initstate

@override
void initState() {
    super.initState();

    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      auth = Provider.of<Auth>(context, listen: false);
    });
}

################ OR

@override
void initState() {
  super.initState();
  
  Future.delayed(Duration.zero,() {
    //Do your stuff here
  });
}
Posted by: Guest on June-27-2021

Browse Popular Code Answers by Language