Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

card_swiper EXCEPTION: _CastError was thrown while dispatching notifications for SwiperController #35

Open
siva-rajendran opened this issue Mar 3, 2022 · 3 comments

Comments

@siva-rajendran
Copy link

siva-rajendran commented Mar 3, 2022

Case:

I am getting this error when my swiper scaffold is in app background.

[*] I am using smooth_page_indicator for showing custom dots pagination

Initially i load the main page (which has the swiper) based on conditions i move to some other page, in the background i am getting these errors/exceptions. Only when swiper is in background of flutter app i get this kind of exception.

Any idea to solve !!!

Error: Null check operator used on a null value

Exception Caught:

======== Exception caught by foundation library ====================================================
The following _CastError was thrown while dispatching notifications for SwiperController:
Null check operator used on a null value

When the exception was thrown, this was the stack: 
#0      ScrollPosition.viewportDimension (package:flutter/src/widgets/scroll_position.dart:175:53)
#1      _PagePosition.getPixelsFromPage (package:flutter/src/widgets/page_view.dart:396:19)
#2      PageController.animateToPage (package:flutter/src/widgets/page_view.dart:202:16)
#3      _TransformerPageViewState.onChangeNotifier (package:card_swiper/src/transformer_page_view/transformer_page_view.dart:576:14)
#4      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:308:24)
#5      IndexController.next (package:card_swiper/src/transformer_page_view/index_controller.dart:110:5)
#6      _SwiperTimerMixin._onTimer (package:card_swiper/src/swiper.dart:388:17)
(elided 10 frames from class _RawReceivePortImpl, class _Timer, and dart:async)
The SwiperController sending notification was: Instance of 'SwiperController'
====================================================================================================
@king2088
Copy link

king2088 commented Apr 20, 2022

same issue

/D:/flutterSDK/.pub-cache/hosted/pub.flutter-io.cn/card_swiper-2.0.3/lib/src/custom_layout.dart:36:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart'
    ('/D:/flutterSDK/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.addPostFrameCallback(_getSize);
    ^
    /D:/flutterSDK/.pub-cache/hosted/pub.flutter-io.cn/card_swiper-2.0.3/lib/src/transformer_page_view/transformer_page_view.dart:540:22: Warning: Operand of null-aware operation '!' has type
    'WidgetsBinding' which excludes null.
  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart'
    ('/D:/flutterSDK/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.addPostFrameCallback(_onGetSize);
    ^
    /D:/flutterSDK/.pub-cache/hosted/pub.flutter-io.cn/card_swiper-2.0.3/lib/src/transformer_page_view/transformer_page_view.dart:554:22: Warning: Operand of null-aware operation '!' has type
    'WidgetsBinding' which excludes null.
  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart'
    ('/D:/flutterSDK/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.addPostFrameCallback(_onGetSize);
    ^

Another exception was thrown: Null check operator used on a null value
Performing hot restart...
Restarted application in 1,670ms.

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY
╞═════════════════════════════════════════════════════════
The following assertion was thrown during performResize():
Horizontal viewport was given unbounded height.
Viewports expand in the cross axis to fill their container and constrain their children to match
their extent in the cross axis. In this case, a horizontal viewport was given an unlimited amount
of
vertical space in which to expand.

The relevant error-causing widget was:
PageView
PageView:file:///D:/flutterSDK/.pub-cache/hosted/pub.flutter-io.cn/card_swiper-2.0.3/lib/src/tra nsformer_page_view/transformer_page_view.dart:426:28

When the exception was thrown, this was the stack: #0 RenderViewport.computeDryLayout.<anonymous closure> (package:flutter/src/rendering/viewport.dart:1424:15) #1 RenderViewport.computeDryLayout (package:flutter/src/rendering/viewport.dart:1436:6) #2 RenderBox.performResize (package:flutter/src/rendering/box.dart:2381:12) #3 RenderObject.layout (package:flutter/src/rendering/object.dart:1894:9) #4 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #5 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #6 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #7 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #8 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #9 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #10 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #11 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #12 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #13 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #14 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #16 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #17 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #18 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #19 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11) #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #21 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #23 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:56:11) #24 RenderStack._computeSize (package:flutter/src/rendering/stack.dart:552:43) #25 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:579:12) #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #27 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #28 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #30 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #31 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:213:28) #32 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #33 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12) #34 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11) #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #36 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13) #37 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12) #38 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20) #39 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #40 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #41 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #42 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #43 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #44 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #45 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #46 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #47 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #48 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #49 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #50 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #51 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #52 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #53 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #54 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #55 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11) #56 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #57 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #58 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #59 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12) #60 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1003:7) #61 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7) #62 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:403:14) #63 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #64 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #65 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #66 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #67 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1376:11) #68 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #69 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #70 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #71 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #72 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #73 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #74 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #75 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #76 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #77 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #78 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #79 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #80 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #81 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #82 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #83 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #84 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #85 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #86 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #87 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #88 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #89 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #90 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #91 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #93 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #94 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #95 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #97 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #99 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #100 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #101 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #102 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3462:13) #103 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #104 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #105 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #106 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:749:15) #107 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #108 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #109 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #110 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #111 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #112 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #113 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #114 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #115 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11) #116 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #117 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #118 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #119 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #120 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #121 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #122 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #123 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #124 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #125 RenderView.performLayout (package:flutter/src/rendering/view.dart:165:14) #126 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1757:7) #127 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18) #128 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:501:19) #129 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:892:13) #130 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:367:5) #131 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)#132 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9) #133 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7) (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)

The following RenderObject was being processed when the exception was fired: RenderViewport#8f706
NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
needs compositing
creator: Viewport ← IgnorePointer-[GlobalKey#5ae55] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey#a106c] ← Listener ←
_ScrollableScope
← _ScrollSemantics-[GlobalKey#589dc] ← NotificationListener ←
RepaintBoundary ← CustomPaint ← ⋯
parentData: (can use size)
constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
size: MISSING
axisDirection: right
crossAxisDirection: down
offset: _PagePosition#31da4(range: null..null, viewport: null, ScrollableState,
_ForceImplicitScrollPhysics -> PageScrollPhysics -> ClampingScrollPhysics ->
RangeMaintainingScrollPhysics, IdleScrollActivity#a878c, ScrollDirection.idle)
anchor: 0.0
This RenderObject had the following descendants (showing up to depth 5):
center child: _RenderSliverFractionalPadding#a273a NEEDS-LAYOUT NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
child: RenderSliverFillViewport#49527 NEEDS-LAYOUT NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: RenderBox was not laid out: RenderViewport#8f706 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderViewport#8f706 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#067ab
relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#64ea0
relayoutBoundary=up13 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderPointerListener#3eae5
relayoutBoundary=up12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#527cd
relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderPointerListener#7e523
relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#12fe2
relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#bc4da
relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#e116e
relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#2b8ef
relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderStack#d83e3 relayoutBoundary=up5
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#f036e
relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart':
Failed assertion: line 544 pos 12: 'child.hasSize': is not true.

Another exception was thrown: Null check operator used on a null value

Another exception was thrown: Null check operator used on a null value

Another exception was thrown: Null check operator used on a null value

@gxhx
Copy link

gxhx commented Feb 2, 2023

Same issue!
Wrapping Swiper with a ConstrainedBox solves this problem!
I constrained its height,it works!

@ldbmcs
Copy link

ldbmcs commented Jan 27, 2024

Same issue! Wrapping Swiper with a ConstrainedBox solves this problem! I constrained its height,it works!

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants