DEV Community

Kaede Games ๐ŸŽฎ
Kaede Games ๐ŸŽฎ

Posted on • Updated on

[Flutter] Solved Android clashing when native back button pressed.

You can solve by ๐Ÿ‘‡

  Future<bool> _onWillPop() async {
    final isFirstRouteInCurre
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hklmjrm3euq5ofd084o.jpeg)ntTab =
        !await _navigatorKeys[_currentTab].currentState.maybePop();
    if (isFirstRouteInCurrentTab) {
      if (_currentTab != TabItem.home) {
        _onSelect(TabItem.home);
        return false;
      }
    }
    return isFirstRouteInCurrentTab;
  }
Enter fullscreen mode Exit fullscreen mode

๐Ÿฅณ

Top comments (0)