Back to results for “Navigation”
Flutter › Navigation & Routing in Flutter

How can you properly pass a result value back to the previous screen when calling Navigator.pop, such as returning a genuinely selected item from a picker screen?

Beginner

Answer

Navigator.pop accepts an optional second parameter representing whatever specific result value you genuinely want to actually return back to the previous screen, and the original screen that had originally called Navigator.push can then properly retrieve that particular returned result by simply awaiting the Future that push itself genuinely returns, letting you build genuinely common patterns such as a dedicated selection screen that returns a user's own specific chosen item directly back to whatever screen had originally navigated to it.
final selectedItem = await Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => PickerScreen()),
);

// On the picker screen
Navigator.pop(context, chosenItem);
Real-world example A form screen navigates to a dedicated category picker screen, properly awaiting and correctly receiving back the user's own specific chosen category the moment they actually tap it, directly updating that original form's own display with that particular returned selected value.

Common follow-ups: What genuinely happens if a user simply presses the physical back button rather than the picker screen explicitly returning a value?;Can you actually pop several separate screens off the stack together all at once?