Answers for "modal route inside initstate flutter"

0

modal route inside initstate flutter

var = args;
_yourFunction(args) async {
// whatever you want to do
}

@override
  void initState() {
    super.initState();
    // future that allows us to access context. function is called inside the future
    // otherwise it would be skipped and args would return null
    Future.delayed(Duration.zero, () {
      setState(() => args = ModalRoute.of(context).settings.arguments);
      _yourFunction(args);
    });
  }
Posted by: Guest on August-01-2021

Browse Popular Code Answers by Language