Skip to content

Error using SelectionArea with nested routes #117527

Closed

Description

@k-ane

Steps to Reproduce

Wrapping a page with a selection area will not work if it is not the topmost route. Likely not an issue with GoRouter just my router of choice to demonstrate the issue.

Expected results:

I would expect SelectionArea to not cause any issues when wrapping my routes.

Actual results:

If I was to load the app on the initial/lowest route, then navigate to the nested route, all would work fine.

But if I go straight to the nested route, such as you might on the web, the error occurs.

Code sample
final router = GoRouter(
  // Default to the nested location
  // Or for a more realistic use-case, navigate to the url /a/b on the web
  initialLocation: '/a/b',
  routes: [
    GoRoute(
      path: '/a',
      builder: (_, __) {
        // With selection area here, error will occur
        return const SelectionArea(child: Text('Page a'));
        // With no selection area here, error will not occur
        // return Text('Page a');
      },
      routes: [
        GoRoute(
          path: 'b',
          builder: (_, __) {
            return const SelectionArea(child: Text('Page b'));
          },
        ),
      ],
    ),
  ],
);
Logs
════════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
'package:flutter/src/rendering/paragraph.dart': Failed assertion: line 963 pos 12: '!debugNeedsLayout': is not true.
package:flutter/…/rendering/paragraph.dart:963
2

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack
#2      RenderParagraph.getBoxesForSelection
package:flutter/…/rendering/paragraph.dart:963
#3      _SelectableFragment._rect
package:flutter/…/rendering/paragraph.dart:1501
#4      _SelectableFragment.getTransformToParagraph
package:flutter/…/rendering/paragraph.dart:1475
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.10, on macOS 12.6 21G115 darwin-arm, locale
    en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version
    33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.74.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Activity

  1. darshankawar commented on Dec 22, 2022

    @darshankawar
    Member

    Thanks for the report.
    Using the code sample provided, seeing the same behavior as reported.

    stable, master flutter doctor -v
    [✓] Flutter (Channel stable, 3.3.10, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.3.10 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 135454af32 (15 hours ago), 2022-12-15 07:36:55 -0800
        • Engine revision 3316dd8728
        • Dart version 2.18.6
        • DevTools version 2.15.0
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.7.0-13.0.pre.39, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.7.0-13.0.pre.39 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 9fb1ae839e (2 hours ago), 2022-12-21 18:47:11 -0800
        • Engine revision a90c45db3f
        • Dart version 3.0.0 (build 3.0.0-55.0.dev)
        • DevTools version 2.20.0
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIs
    a: error messageError messages from the Flutter framework
    f: routesNavigator, Router, and related APIs.
    and removed
    in triagePresently being triaged by the triage team
    on Dec 22, 2022
  3. goderbauer commented on Jan 3, 2023

    @goderbauer
    Member
  4. added
    P2Important issues not at the top of the work list
    on Jan 3, 2023
  5. Renzo-Olivares commented on Feb 19, 2026

    @Renzo-Olivares
    Contributor

    I was not able to reproduce this issue on the latest master commit. @k-ane is this something you are still experiencing? This seems similar to #151536 which I can reproduce. If, so maybe we can close this one in favor of that one.

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 19, 2026
  7. moved this from Incoming Issues to Prioritized in SelectableRegion Improvementson Mar 2, 2026
  8. moved this from Updated to Waiting for Response in SelectableRegion Improvementson Mar 5, 2026
  9. github-actions commented on Mar 12, 2026

    @github-actions

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
    If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
    Thanks for your contribution.

  10. moved this from Waiting for Response to Done in SelectableRegion Improvementson Mar 12, 2026
  11. github-actions commented on Mar 26, 2026

    @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.

  12. locked as resolved and limited conversation to collaborators on Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworkf: routesNavigator, Router, and related APIs.f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions