Skip to content

onGenerate called multiple times when app is closed with the back button #79810

Closed
flutter-team-archive/engine
#25496

Description

@johnpryan

Pushing a deep link /details/1 makes three calls to onGenerateRoute when the app is closed with the back button. It get's called for each segment of the path, so if the user opens a link like/details/1, onGenerateRoute is called with settings.name set to /, /details, and /details/1.

When the app is open, there is only one call to onGenerateRoute, /details/1.

I've reproduced this on the master and stable channels (2.0.3)

Steps to Reproduce

  1. Create a new Flutter project
  2. Paste in the on_generate_route.dart sample.
  3. Enable deep linking – add the following to app/src/main/AndroidManifest.xml
            <!-- Deep linking -->
            <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="flutterbooksample.com" />
                <data android:scheme="https" />
            </intent-filter>
  1. Set a breakpoint on line 21 and run the app in debug mode
  2. press the back button to close the app
  3. trigger a deep link using the adb command:
adb shell am start -a android.intent.action.VIEW \
    -c android.intent.category.BROWSABLE \
    -d "http://flutterbooksample.com/details/1"
  1. Observe that the breakpoint in onGenerateRoute is hit 3 times with /, /details and /details/1.
  2. Repeat step 5 and 6 again
  3. Observe error:
NoSuchMethodError: No top-level getter '_registerPlugins' declared.
Receiver: top-level
Tried calling: _registerPlugins

Related issues

Logs

Logs

Activity

  1. added
    platform-androidAndroid applications specifically
    engineflutter/engine related. See also e: labels.
    on Apr 5, 2021
  2. johnpryan commented on Apr 5, 2021

    @johnpryan
    ContributorAuthor
  3. self-assigned this
    on Apr 8, 2021
  4. github-actions commented on Aug 3, 2021

    @github-actions

    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.

  5. locked as resolved and limited conversation to collaborators on Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions