How to get returned value from Navigator.pop using Navigator.restorable?

Viewed 55

Currently my original way of getting values between screen using Navigator.pop was like this:

Second screen goes back to home screen and passes a boolean:

Navigator.pop(context, false);

Home screen awaiting for the Navigator and capturing the value:

var bookmarked = await Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => const CorePage()),
);

However I've recently started using restorable to restore states when the app randomly closes such as:

static Route<void> _staticGoToCoreWorkout(context, arguments) =>
      MaterialPageRoute(builder: (context) => const CorePage());

Navigator.restorablePush(context, _staticGoToCoreWorkout);

The problem I'm having is that something like this doesn't work anymore:

var bookmarked = Navigator.restorablePush(context, _staticGoToCoreWorkout);

How can I go about getting the boolean value (or any value really) that's passed from the Navigator.pop back to the previous screen when I'm using restorable?

UPDATED:

Adding await doesn't yield results either. It will always run pass the code.

var bookmarked = await Navigator.restorablePush(context, _staticGoToCoreWorkout);
0 Answers
Related