Skip to content

Improve error message when PageController is not attached to PageView #138945

@Dampfwalze

Description

@Dampfwalze

Is there an existing issue for this?

Steps to reproduce

Use either animateToPage or jumpToPage on an unattached PageController:

var pageController = PageController();
pageController.animateToPage(1);

Expected results

The error message should be more like: PageController not attached to a PageView. Maybe you forgot to assign it to your PageView widget?

Actual results

The error message is: ScrollController not attached to any scroll views., which is very unhelpfull to the user

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.19045.3693], locale de-DE)
    • Flutter version 3.16.0 on channel stable at [...]
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (8 days ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at [...]
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.6)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34221.43
    • Windows 10 SDK version 10.0.19041.0

[✓] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\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
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[✓] VS Code (version 1.84.2)
    • VS Code at [...]
    • Flutter extension version 3.54.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.3693]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 119.0.6045.105
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 119.0.2151.58

[✓] Network resources
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworkc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions