Skip to content

StreamBuilders cannot be the first child of CustomScrollView #25861

@lukepighetti

Description

@lukepighetti

Hello,

I found a bug where if a StreamBuilder is the first child of a CustomScrollView it will throw these two errors randomly.

flutter: Another exception was thrown: 'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1213 pos 12: 'center.parent == this': is not true.
flutter: Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.

It does not matter if the StreamBuilder is returning a sliver or not.

What's worse is it's not consistent. Out of 10 tries it will happen maybe 6 times and in seemingly random order. Possible race condition?

The workaround is to place a SliverToBoxAdapter() as the first child, then the problem goes away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions