DEV Community

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

Posted on โ€ข Edited 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)

๐Ÿ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay