stream-chat-flutter icon indicating copy to clipboard operation
stream-chat-flutter copied to clipboard

The following assertion was thrown during performLayout(): RenderBox was not laid out:

Open crataristo4 opened this issue 1 year ago • 5 comments

Which packages are you using?

stream_chat, stream_chat_flutter, stream_chat_flutter_core

On what platforms did you experience the issue?

Android, iOS

What version are you using?

stream_chat_flutter: ^9.17.0 stream_chat_flutter_core: ^9.17.0 stream_chat: ^9.17.0 flutter_slidable: ^4.0.1

What happened?

The channels were showing as expected until this morning where i run into issues

Steps to reproduce

1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
...

Supporting info to reproduce

No response

Relevant log output

======== Exception caught by rendering library =====================================================
The following _TypeError was thrown during performLayout():
Null check operator used on a null value

The relevant error-causing widget was: 
  ListView ListView:file:///Users/devenoch/.pub-cache/hosted/pub.dev/stream_chat_flutter_core-9.17.0/lib/src/paged_value_scroll_view.dart:298:29
When the exception was thrown, this was the stack: 
#0      RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:147:63)
#1      RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11)
#2      RenderObject.layout (package:flutter/src/rendering/object.dart:2762:7)
#3      RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:673:13)
#4      RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1684:12)
#5      RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1575:20)
#6      RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2610:7)
#7      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1157:18)
#8      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1170:15)
#9      RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:629:23)
#10     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1261:13)
#11     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#12     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1434:15)
#13     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1347:9)
#14     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1200:5)
#15     _invoke (dart:ui/hooks.dart:330:13)
#16     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:444:5)
#17     _drawFrame (dart:ui/hooks.dart:302:31)
The following RenderObject was being processed when the exception was fired: RenderSliverPadding#2044b relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT
...  needs compositing
...  parentData: paintOffset=Offset(0.0, 0.0) (can use size)
...  constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, precedingScrollExtent: 0.0, remainingPaintExtent: 730.0, crossAxisExtent: 440.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 730.0, remainingCacheExtent: 980.0, cacheOrigin: 0.0)
...  geometry: null
...  padding: EdgeInsets.zero
...  textDirection: ltr
RenderObject: RenderSliverPadding#2044b relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT
  needs compositing
  parentData: paintOffset=Offset(0.0, 0.0) (can use size)
  constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, precedingScrollExtent: 0.0, remainingPaintExtent: 730.0, crossAxisExtent: 440.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 730.0, remainingCacheExtent: 980.0, cacheOrigin: 0.0)
  geometry: null
  padding: EdgeInsets.zero
  textDirection: ltr
...  child: RenderSliverList#473b8 relayoutBoundary=up2 NEEDS-PAINT
...    needs compositing
...    parentData: paintOffset=Offset(0.0, 0.0) (can use size)
...    constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, precedingScrollExtent: 0.0, remainingPaintExtent: 730.0, crossAxisExtent: 440.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 730.0, remainingCacheExtent: 980.0, cacheOrigin: 0.0)
...    geometry: null
...    currently live children: 0 to 0
...    child with index 0: RenderIndexedSemantics#caa96 relayoutBoundary=up3 NEEDS-PAINT
...      needs compositing
...      parentData: index=0; layoutOffset=0.0 (can use size)
...      constraints: BoxConstraints(w=440.0, 0.0<=h<=Infinity)
...      size: MISSING
...      index: 0
...      child: RenderRepaintBoundary#a48e0 relayoutBoundary=up4 NEEDS-PAINT
...        needs compositing
...        parentData: <none> (can use size)
...        constraints: BoxConstraints(w=440.0, 0.0<=h<=Infinity)
...        size: MISSING
...        usefulness ratio: no metrics collected yet (never painted)
...        child: RenderSemanticsGestureHandler#448d1 relayoutBoundary=up5 NEEDS-PAINT
...          needs compositing
...          parentData: <none> (can use size)
...          constraints: BoxConstraints(w=440.0, 0.0<=h<=Infinity)
...          size: MISSING
...          behavior: opaque
...          gestures: horizontal scroll
====================================================================================================

======== Exception caught by rendering library =====================================================
The following _TypeError was thrown during performLayout():
Null check operator used on a null value

The relevant error-causing widget was: 
  ListView ListView:file:///Users/devenoch/.pub-cache/hosted/pub.dev/stream_chat_flutter_core-9.17.0/lib/src/paged_value_scroll_view.dart:298:29
When the exception was thrown, this was the stack: 
#0      RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:694:64)
#1      RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1684:12)
#2      RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1575:20)
#3      RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2610:7)
#4      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1157:18)
#5      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1170:15)
#6      RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:629:23)
#7      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1261:13)
#8      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1434:15)
#10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1347:9)
#11     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1200:5)
#12     _invoke (dart:ui/hooks.dart:330:13)
#13     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:444:5)
#14     _drawFrame (dart:ui/hooks.dart:302:31)
The following RenderObject was being processed when the exception was fired: RenderViewport#9ae34 NEEDS-LAYOUT NEEDS-PAINT
...  needs compositing
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(0.0<=w<=440.0, 0.0<=h<=730.0)
...  size: Size(440.0, 730.0)
...  axisDirection: down
...  crossAxisDirection: right
...  offset: ScrollPositionWithSingleContext#96229(offset: 0.0, range: null..null, viewport: 730.0, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#ea96d, ScrollDirection.idle)
...  anchor: 0.0
RenderObject: RenderViewport#9ae34 NEEDS-LAYOUT NEEDS-PAINT
  needs compositing
  parentData: <none> (can use size)
  constraints: BoxConstraints(0.0<=w<=440.0, 0.0<=h<=730.0)
  size: Size(440.0, 730.0)
  axisDirection: down
  crossAxisDirection: right
  offset: ScrollPositionWithSingleContext#96229(offset: 0.0, range: null..null, viewport: 730.0, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#ea96d, ScrollDirection.idle)
  anchor: 0.0
...  center child: RenderSliverPadding#2044b relayoutBoundary=up1 NEEDS-PAINT
...    needs compositing
...    parentData: paintOffset=Offset(0.0, 0.0) (can use size)
...    constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, precedingScrollExtent: 0.0, remainingPaintExtent: 730.0, crossAxisExtent: 440.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 730.0, remainingCacheExtent: 980.0, cacheOrigin: 0.0)
...    geometry: null
...    padding: EdgeInsets.zero
...    textDirection: ltr
...    child: RenderSliverList#473b8 relayoutBoundary=up2 NEEDS-PAINT
...      needs compositing
...      parentData: paintOffset=Offset(0.0, 0.0) (can use size)
...      constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, precedingScrollExtent: 0.0, remainingPaintExtent: 730.0, crossAxisExtent: 440.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 730.0, remainingCacheExtent: 980.0, cacheOrigin: 0.0)
...      geometry: null
...      currently live children: 0 to 0
...      child with index 0: RenderIndexedSemantics#caa96 relayoutBoundary=up3 NEEDS-PAINT
...        needs compositing
...        parentData: index=0; layoutOffset=0.0 (can use size)
...        constraints: BoxConstraints(w=440.0, 0.0<=h<=Infinity)
...        size: MISSING
...        index: 0
...        child: RenderRepaintBoundary#a48e0 relayoutBoundary=up4 NEEDS-PAINT
...          needs compositing
...          parentData: <none> (can use size)
...          constraints: BoxConstraints(w=440.0, 0.0<=h<=Infinity)
...          size: MISSING
...          usefulness ratio: no metrics collected yet (never painted)

Flutter analyze output


Flutter doctor output

[✓] Flutter (Channel stable, 3.35.3, on macOS 15.6.1 24G90 darwin-arm64, locale en-GH) [509ms]
    • Flutter version 3.35.3 on channel stable at /Users/devenoch/src/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a402d9a437 (3 weeks ago), 2025-09-03 14:54:31 -0700
    • Engine revision ddf47dd3ff
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [5.7s]
    • Android SDK at /Users/devenoch/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-Baklava-ext19, build-tools 36.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1,824ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [8ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [7ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 21.0.7+-13880790-b1038.58)

[✓] Android Studio (version 2024.2) [7ms]
    • Android Studio at /Applications/Lady Bug.app/Contents
    • 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 21.0.5+-13047016-b750.29)

[✓] VS Code (version 1.104.1) [6ms]
    • VS Code at /Users/devenoch/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.118.0

[✓] Connected device (4 available) [6.4s]
    • Dev Enoch (wireless) (mobile) • 00008110-000A48801131801E            • ios            • iOS 18.6 22G86
    • iPhone 16 Pro Max (mobile)    • 53657369-3783-4FE9-B303-0AE5B573B156 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-6 (simulator)
    • macOS (desktop)               • macos                                • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)                  • chrome                               • web-javascript • Google Chrome 140.0.7339.207

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

• No issues found!

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

crataristo4 avatar Sep 26 '25 10:09 crataristo4

@crataristo4 , can you share the steps to reproduce this? or which screen are you getting this in?

xsahil03x avatar Sep 26 '25 10:09 xsahil03x

on the StreamChannelListView @xsahil03x

crataristo4 avatar Sep 26 '25 10:09 crataristo4

@crataristo4 Can you try to replicate this in our sample_app?

xsahil03x avatar Sep 26 '25 15:09 xsahil03x

Hmmm strange . Would take a look @xsahil03x

crataristo4 avatar Sep 26 '25 15:09 crataristo4

Hey, you can help us out by closing this issue if the problem no longer exists, or adding more information.

github-actions[bot] avatar Oct 04 '25 00:10 github-actions[bot]