Skip to content

Tabs and scrolling demo can crash - null.scrollTo() #4193

Description

@HansMuller

This occurred while swiping repeatedly and rapidly in one direction.

Running lib/main.dart on Nexus 5...
--------- beginning of main
Observatory listening on http://127.0.0.1:48446
Diagnostic server listening on http://127.0.0.1:57845
Application running.
Type "h" or F1 for help, "r" or F5 to restart the app, and "q", F10, or ctrl-c to quit.
W/ActivityManager: Unable to start service Intent { cmp=com.google.android.gms/.phenotype.service.PhenotypeCommitChimeraService (has extras) } U=0: not found
E/flutter : [ERROR:dart_error.cc(17)] Unhandled exception:
E/flutter : The null object does not have a method 'scrollTo'.
E/flutter : 
E/flutter : NoSuchMethodError: method not found: 'scrollTo'
E/flutter : Receiver: null
E/flutter : Arguments: [0.0]
E/flutter : #0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
E/flutter : #1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
E/flutter : #2      TabsDemoState.build.<anonymous closure>.<anonymous closure> (/builds/dev/flutter/examples/flutter_gallery/lib/demo/tabs_demo.dart:46)
E/flutter : #3      State.setState (package:flutter/src/widgets/framework.dart:419)
E/flutter : #4      TabsDemoState.build.<anonymous closure> (/builds/dev/flutter/examples/flutter_gallery/lib/demo/tabs_demo.dart:44)
E/flutter : #5      TabBarSelectionState.value=.<anonymous closure> (package:flutter/src/material/tabs.dart:599)
E/flutter : #6      _RootZone.runUnary (dart:async/zone.dart:1204)
E/flutter : #7      _FutureListener.handleValue (dart:async/future_impl.dart:131)
E/flutter : #8      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637)
E/flutter : #9      _Future._propagateToListeners (dart:async/future_impl.dart:667)
E/flutter : #10     _Future._completeWithValue (dart:async/future_impl.dart:477)
E/flutter : #11     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528)
E/flutter : #12     _microtaskLoop (dart:async/schedule_microtask.dart:41)
E/flutter : #13     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)

Activity

  1. added
    c: regressionIt was better in the past than it is now
    p: material_uimaterial_ui package in flutter/packages
    customer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.
    on May 25, 2016
  2. HansMuller commented on May 26, 2016

    @HansMuller
    ContributorAuthor

    In this case, when the app is notified that the selected tab has changed the Scrollable that corresponded to the newly selected TabBarView has been discarded. So its GlobalKey's currentState is null.

    The source of this problem appears to be that the TabBarSelection onChanged() only callback runs when the animation between TabBarView's (between the old and newly selected tab) has completed, and the TabBarViews are materialized and discarded as needed. The TabBarViews are implemented with a PageableList and only two tab pages (for taps on a tab) or three tab pages (for TabBarView left/right drags) are materialized by the PageableList at any time. It looks like it's posisble for the PageableList to be rebuilt more than once before the onChanged callback runs.

  3. eseidelGoogle commented on Jun 17, 2016

    @eseidelGoogle
    Contributor

    Similar to #4195, customer leafy worked around by skipping the test.

  4. modified the milestone: on Aug 1, 2016
  5. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Sep 12, 2016
  6. modified the milestones: , on Jan 30, 2017
  7. modified the milestones: 3: Current Milestone, on Dec 20, 2017
  8. zoechi commented on Jan 9, 2019

    @zoechi
    Contributor

    I can't reproduce #4195 Do you think this is still an issue?

  9. self-assigned this
    on Mar 20, 2019
  10. HansMuller commented on Mar 26, 2019

    @HansMuller
    ContributorAuthor

    Unfortunately this bug corresponds to versions of the tabs implementation and the tabs demo that no longer exist. I can no longer reproduce the crash and code path that was failing is gone. I'm going to close this issue. It's a shame that it has taken so long!

  11. github-actions commented on Aug 17, 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.

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

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consolec: regressionIt was better in the past than it is nowcustomer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.f: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions