LoginSignup
6
2

More than 5 years have passed since last update.

Navigator.pop の第2引数で戻り値を返せる

Posted at

画面遷移し、戻ってきた時に戻り値を受け取る:

final result = await Navigator.of(context).push(
  MyRoute<dynamic>(...)
);
print(result); // => "done!"

結果とともに前の画面に戻る:

Navigator.pop(context, "done!");

Dropdown Menu なんかもこの仕組みで値を返している。

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2