LoginSignup
0
2

More than 1 year has passed since last update.

Flutter で Android戻るボタンを使うとアプリが落ちてしまう対処法

Posted at

これでいけるよ。

onWillPop.dart
  Future<bool> _onWillPop() async {
    final isFirstRouteInCurrentTab =
        !await _navigatorKeys[_currentTab].currentState.maybePop();
    if (isFirstRouteInCurrentTab) {
      if (_currentTab != TabItem.home) {
        _onSelect(TabItem.home);
        return false;
      }
    }
    return isFirstRouteInCurrentTab;
  }

🥳

0
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
0
2