karvulf / flutter-reorderable-grid-view

BSD 3-Clause "New" or "Revised" License
158 stars 23 forks source link

Null check operator used on a null value on release or profile mode when use flutter 3.22.0 #104

Closed lehoangkhang4869 closed 6 months ago

lehoangkhang4869 commented 6 months ago

On flutter 3.22.0, this package works fine in debug mode, but when run in release or profile mode, the package breaks due to framework errors! I tested on your example, it really fails...

ohdonpiano commented 6 months ago

I also confirm this issue

karvulf commented 6 months ago

Hello I will check this later @ohdonpiano @lehoangkhang4869

karvulf commented 6 months ago

I tried to get this error in profile mode on an iPhone 15 but couldn't reproduce it. How did you provoke this error? And which version of the package are you using? @ohdonpiano @lehoangkhang4869

lehoangkhang4869 commented 6 months ago

I used flutter_reorderable_grid_view 4.0.0 and it worked fine in version 3.19.*. However, after upgrading flutter to 3.22 and uploading the app to the store, I discovered that the grid was not loading properly. I tried in debug mode and didn't see any errors, then I tried in release and profile mode and found this error. I tried cloning your project (master branch) and running the example in profile mode, and the following error still appears:

I/flutter (21307): Null check operator used on a null value I/flutter (21307): #0 SliverMultiBoxAdaptorElement.createChild. (package:flutter/src/widgets/sliver.dart:840) I/flutter (21307): #1 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2845) I/flutter (21307): #2 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:837) I/flutter (21307): #3 RenderSliverMultiBoxAdaptor._createOrObtainChild. (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:360) I/flutter (21307): #4 RenderObject.invokeLayoutCallback. (package:flutter/src/rendering/object.dart:2688) I/flutter (21307): #5 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1097) I/flutter (21307): #6 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2688) I/flutter (21307): #7 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349) I/flutter (21307): #8 RenderSliverMultiBoxAdaptor.insertAndLayoutChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:497) I/flutter (21307): #9 RenderSliverGrid.performLayout (package:flutter/src/rendering/sliver_grid.dart:653) I/flutter (21307): #10 RenderObject.layout (package:flutter/src/rendering/object.dart:2577) I/flutter (21307): #11 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:121) I/flutter (21307): #12 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:327) I/flutter (21307): #13 RenderObject.layout (package:flutter/src/rendering/object.dart:2577) I/flutter (21307): #14 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:601) I/flutter (21307): #15 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1516) I/flutter (21307): #16 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1427) I/flutter (21307): #17 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2416) I/flutter (21307): #18 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1051) I/flutter (21307): #19 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1064) I/flutter (21307): #20 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:577) I/flutter (21307): #21 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1138) I/flutter (21307): #22 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:443) I/flutter (21307): #23 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1392) I/flutter (21307): #24 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1313) I/flutter (21307): #25 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1171) I/flutter (21307): #26 _invoke (dart:ui/hooks.dart:312) I/flutter (21307): #27 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419) I/flutter (21307): #28 _drawFrame (dart:ui/hooks.dart:283)

Flutter doctor:

[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.22631.3593], locale en-US) • Flutter version 3.22.0 on channel stable at C:\SDK\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5dcb86f68f (9 days ago), 2024-05-09 07:39:20 -0500 • Engine revision f6344b75dc • Dart version 3.4.0 • DevTools version 2.34.3

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

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at C:\Users\Admin\AppData\Local\Android\sdk • Platform android-34, build-tools 33.0.2 • Java binary at: D:\Setup\AndroidStudio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160) • 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.9.1) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.9.34616.47 • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.3) • Android Studio at D:\Setup\AndroidStudio • 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 17.0.10+0--11572160)

[√] VS Code (version 1.89.1) • VS Code at C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.88.0

[√] Connected device (4 available) • 22081283G (mobile) • 172.16.10.64:38195 • android-arm64 • Android 12 (API 31) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3593] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.208 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.105

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

I got the error on both Android and IOS. I don't know why it happens, and since it only appears on profile and release mode there's no way I can debug :<

lehoangkhang4869 commented 6 months ago

You have to drag an item for the error to appear

karvulf commented 6 months ago

Ah I see, could you try version 5.0.0-dev.10? There are some breaking changes in that version but also a lot of improvements, I think the error should disappear with that version. In a couple of weeks I will release the version 5.0.0 officially @ohdonpiano @lehoangkhang4869