How to preserve then action for route pop when replacing routes?

Issue

So question is a little strange, but I’ll try my best to make it clear.

So we have 3 pages:

  1. page with list of customers
  2. customer info page
  3. customer edit page

The flow is
you tap on customer in list
-> router.push(CustomerInfo).then(_refreshList())
and on Customer Info page we have Edit Customer button which goes to CustomerEdit page like
-> router.replace(CustomerEdit)

how can I specify that after poping the CustomerEdit screen and returning to CustomersList Page refresh function goes off?

Solution

Executing a function after popping works like so:

Navigator.push().then(functiontThatShouldBeExecuted);

Answered By – TheUltimateOptimist

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *