Skip to content

findChildIndexCallback returning negative values causes unusual error message #107123

@kevmo314

Description

@kevmo314

Steps to Reproduce

Create a SliverChildBuilderDelegate that has a findChildIndexCallback that returns -1:

          SliverChildBuilderDelegate(
            ...,
            findChildIndexCallback: (key)  => -1),

Expected results:

Actual results:

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#644bc](state: RawGestureDetectorState#58dd7(gestures: <none>, behavior: opaque)):
'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 258 pos 16: 'child == null || indexOf(child) > index': is not true.
package:flutter/…/rendering/sliver_multi_box_adaptor.dart:258
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
Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolef: scrollingViewports, list views, slivers, etc.found in release: 3.11Found to occur in 3.11found 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 team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions