flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.17k stars 27.48k forks source link

Back button on app bar of Initial route other than '/' records 2 entries in browser history #88730

Closed hrishikesh-kadam closed 3 years ago

hrishikesh-kadam commented 3 years ago

Related to - Issue - flutter/flutter#87897 PR - flutter/flutter#88122

Steps to Reproduce

  1. $ flutter channel master
  2. $ flutter upgrade
  3. Run $ flutter create bug
  4. Update the files as follows: main.dart -> https://gist.github.com/hrishikesh-kadam/78f784338c3e85a5d66fb3b4537c81d2/418a9eb16a4d219f5a448ce73509bc5d5004bcce
  5. $ flutter run -d chrome
  6. Click the back button on the app bar
  7. Right-click on the back button of the browser

Expected results: Only 1 entry should be recorded.

Actual results: 2 entries are being recorded.

Logs `$ flutter run -d chrome --verbose` ``` [ +48 ms] executing: uname -m [ +23 ms] Exit code 0 from: uname -m [ ] x86_64 [ +4 ms] executing: [/home/hrk/main-data/softwares/flutter/channels/master/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +7 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] 369a0e2bc03a3fd3d2fc9cf8b250ff5d7d6c576a [ ] executing: [/home/hrk/main-data/softwares/flutter/channels/master/] git tag --points-at 369a0e2bc03a3fd3d2fc9cf8b250ff5d7d6c576a [ +12 ms] Exit code 0 from: git tag --points-at 369a0e2bc03a3fd3d2fc9cf8b250ff5d7d6c576a [ +1 ms] executing: [/home/hrk/main-data/softwares/flutter/channels/master/] git describe --match *.*.* --long --tags 369a0e2bc03a3fd3d2fc9cf8b250ff5d7d6c576a [ +12 ms] Exit code 128 from: git describe --match *.*.* --long --tags 369a0e2bc03a3fd3d2fc9cf8b250ff5d7d6c576a [ ] fatal: No tags can describe '369a0e2bc03a3fd3d2fc9cf8b250ff5d7d6c576a'. Try --always, or create some tags. [ +2 ms] Could not interpret results of "git describe": [ +3 ms] executing: [/home/hrk/main-data/softwares/flutter/channels/master/] git rev-parse --abbrev-ref --symbolic @{u} [ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ ] origin/master [ ] executing: [/home/hrk/main-data/softwares/flutter/channels/master/] git ls-remote --get-url origin [ +3 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +59 ms] executing: [/home/hrk/main-data/softwares/flutter/channels/master/] git rev-parse --abbrev-ref HEAD [ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] master [ +38 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +47 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +58 ms] Skipping pub get: version match. [ +90 ms] Generating /mnt/common-data/study-material/flutter/bugs/back_button_app_bar_initial_route/bug/android/ app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +125 ms] Launching lib/main.dart on Chrome in debug mode... [ +76 ms] Updating assets [ +59 ms] Waiting for connection from debug service on Chrome... [ +71 ms] <- reset [ +5 ms] /home/hrk/main-data/softwares/flutter/channels/master/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/hrk/main-data/softwares/flutter/channels/master/bin/cache/artifacts/engine/linux-x64/ frontend_server.dart.snapshot --sdk-root /home/hrk/main-data/softwares/flutter/channels/master/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.HAOFHY/flutter_tool.BBPIAW/app.dill --libraries-spec file:///home/hrk/main-data/softwares/flutter/channels/master/bin/cache/flutter_web_sdk/libr aries.json --packages /mnt/common-data/study-material/flutter/bugs/back_button_app_bar_initial_route/bug/.dart_to ol/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-root /tmp/flutter_tools.HAOFHY/flutter_tools.UCTCJD --filesystem-scheme org-dartlang-app --initialize-from-dill build/b1b715402d823b7fd5c2b68d2edcb2ce.cache.dill.track.dill --platform file:///home/hrk/main-data/softwares/flutter/channels/master/bin/cache/flutter_web_sdk/kern el/flutter_ddc_sdk_sound.dill --sound-null-safety [ +6 ms] <- compile org-dartlang-app:/web_entrypoint.dart [+12548 ms] Waiting for connection from debug service on Chrome... (completed in 12.6s) [ ] Synced 26.4MB. [ ] <- accept [ ] Caching compiled dill [ +131 ms] Using Google Chrome 92.0.4515.159 [ +61 ms] executing: uname -m [ +4 ms] Exit code 0 from: uname -m [ ] x86_64 [ +119 ms] [CHROME]: [ ] [CHROME]:DevTools listening on ws://127.0.0.1:38291/devtools/browser/94ce4876-b99d-476f-8d99-f963c2601b4c [ +156 ms] DwdsInjector: Received request for entrypoint at http://localhost:41053/main_module.bootstrap.js [ +3 ms] MetadataProvider: Loading debug metadata... [ +10 ms] MetadataProvider: Loaded debug metadata (sound null safety) [ +4 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:41053/main_module.bootstrap.js [+1264 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true [ +51 ms] DevHandler: Debug service listening on ws://127.0.0.1:33727/Kg5npfymqfE=/ws [ +17 ms] This app is linked to the debug service: ws://127.0.0.1:33727/Kg5npfymqfE=/ws [ +7 ms] Debug service listening on ws://127.0.0.1:33727/Kg5npfymqfE=/ws [ ] 💪 Running with sound null safety 💪 [ +2 ms] 🔥 To hot restart changes while running, press "r" or "R". [ ] For a more detailed help message, press "h". To quit, press "q". [ ] An Observatory debugger and profiler on Chrome is available at: http://127.0.0.1:33727/Kg5npfymqfE= [ +718 ms] DevTools activation throttled until 2021-08-24 07:48:02.748046. [+1138 ms] The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:33727/Kg5npfymqfE= ``` `$ flutter analyze` ``` nalyzing bug... info • Use key in widget constructors • lib/main.dart:14:7 • use_key_in_widget_constructors info • Private field could be final • lib/main.dart:20:22 • prefer_final_fields info • Private field could be final • lib/main.dart:21:30 • prefer_final_fields info • Use isEmpty instead of length • lib/main.dart:46:9 • prefer_is_empty info • The parameter 'path' should have the name 'configuration' to match the name used in the overridden method • lib/main.dart:64:59 • avoid_renaming_method_parameters info • Prefer const with constant constructors • lib/main.dart:66:14 • prefer_const_constructors info • Prefer const with constant constructors • lib/main.dart:69:14 • prefer_const_constructors info • Annotate overridden members • lib/main.dart:80:35 • annotate_overrides info • Annotate overridden members • lib/main.dart:93:21 • annotate_overrides info • Prefer const with constant constructors • lib/main.dart:108:16 • prefer_const_constructors info • Prefer const with constant constructors • lib/main.dart:115:29 • prefer_const_constructors info • The parameter 'path' should have the name 'configuration' to match the name used in the overridden method • lib/main.dart:135:46 • avoid_renaming_method_parameters info • Annotate overridden members • lib/main.dart:169:9 • annotate_overrides info • Prefer declaring const constructors on `@immutable` classes • lib/main.dart:202:3 • prefer_const_constructors_in_immutables info • Use key in widget constructors • lib/main.dart:202:3 • use_key_in_widget_constructors info • Prefer declaring const constructors on `@immutable` classes • lib/main.dart:228:3 • prefer_const_constructors_in_immutables info • Use key in widget constructors • lib/main.dart:228:3 • use_key_in_widget_constructors info • Use key in widget constructors • lib/main.dart:250:7 • use_key_in_widget_constructors info • Prefer const with constant constructors • lib/main.dart:255:13 • prefer_const_constructors info • Prefer const with constant constructors • lib/main.dart:256:16 • prefer_const_constructors info • Unused import: 'package:bug/main.dart' • test/widget_test.dart:11:8 • unused_import error • The name 'MyApp' isn't a class • test/widget_test.dart:16:35 • creation_with_non_type 22 issues found. (ran in 1.1s) ``` The above issues can be ignored as they have araised due to the introduction of flutter_lint. `$ flutter doctor -v` ``` [✓] Flutter (Channel master, 0.0.0-unknown, on Ubuntu 21.04 5.11.0-31-generic, locale en_IN) • Flutter version 0.0.0-unknown at /home/hrk/main-data/softwares/flutter/channels/master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 369a0e2bc0 (5 hours ago), 2021-08-23 09:17:04 -0400 • Engine revision 710af46d53 • Dart version 2.15.0 (build 2.15.0-42.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /mnt/common-data/softwares/android/sdk/linux • Platform android-31, build-tools 31.0.0 • ANDROID_SDK_ROOT = /mnt/common-data/softwares/android/sdk/linux • Java binary at: /snap/android-studio/current/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at google-chrome [✓] Linux toolchain - develop for Linux desktop • Ubuntu clang version 12.0.0-3ubuntu1~21.04.1 • cmake version 3.18.4 • ninja version 1.10.1 • pkg-config version 0.29.2 [✓] Android Studio (version 2020.3) • Android Studio at /snap/android-studio/114/android-studio • Flutter plugin version 59.0.2 • Dart plugin version 203.8292 • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) [✓] Android Studio (version 4.2) • Android Studio at /snap/android-studio/113/android-studio • Flutter plugin version 58.0.1 • Dart plugin version 202.8531 • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821) [✓] Android Studio • Android Studio at /snap/android-studio/current/android-studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /snap/android-studio/current/android-studio • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) [✓] IntelliJ IDEA Community Edition (version 2021.1) • IntelliJ at /snap/intellij-idea-community/310 • Flutter plugin installed • Dart plugin version 211.7727 [✓] IntelliJ IDEA Community Edition (version 2021.2) • IntelliJ at /snap/intellij-idea-community/315 • Flutter plugin installed • Dart plugin version 212.4746.57 [✓] VS Code • VS Code at /snap/code/current • Flutter extension version 3.25.0 [✓] Connected device (2 available) • Linux (desktop) • linux • linux-x64 • Ubuntu 21.04 5.11.0-31-generic • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159 • No issues found! ```
hrishikesh-kadam commented 3 years ago

Closing as this is the intended behavior. Reference - https://github.com/flutter/flutter/issues/87897#issuecomment-904060553

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.