MTtankkeo / flutter_touch_ripple

This flutter package is customizable touch ripple effect widget for flutter, very flexible and performant, providing smooth touch effect animations.
https://pub.dev/packages/flutter_touch_ripple
BSD 3-Clause "New" or "Revised" License
15 stars 1 forks source link

Type 'Null' is not a subtype of type 'RenderBox' in type cast. #1

Open jitender-skycap opened 3 weeks ago

jitender-skycap commented 3 weeks ago

I had developed an app and use firebase crashlytics to that and logged with occurrence of crash.

      Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: type 'Null' is not a subtype of type 'RenderBox' in type cast. Error thrown .
   at BaseTouchRippleGestureRecognizer._renderBox(base_recognizer.dart:40)
   at BaseTouchRippleGestureRecognizer.handleEvent(base_recognizer.dart:65)
   at PointerRouter._dispatch(pointer_router.dart:98)
   at PointerRouter._dispatchEventToRoutes.<fn>(pointer_router.dart:143)
   at _LinkedHashMapMixin.forEach(dart:collection)
   at PointerRouter._dispatchEventToRoutes(pointer_router.dart:141)
   at PointerRouter.route(pointer_router.dart:127)
   at GestureBinding.handleEvent(binding.dart:501)
   at GestureBinding.dispatchEvent(binding.dart:481)
   at RendererBinding.dispatchEvent(binding.dart:450)
   at GestureBinding._handlePointerEventImmediately(binding.dart:426)
   at GestureBinding.handlePointerEvent(binding.dart:389)
   at GestureBinding._flushPointerEventQueue(binding.dart:336)
   at GestureBinding._handlePointerDataPacket(binding.dart:305)

   when I tried to figure it locally no crash was found, any help.??

   Note:- I was using its 1.1.21 version, and now I update to latest on ie 2.2.1. Will this help in reducing crash??
MTtankkeo commented 3 weeks ago

Thanks for reporting this issue. It seems that the RenderBox being null is an extremely rare situation, which is why there is no exception handling for it. Even in the latest version, this issue could still occur, so it’s important to address it. However, it would be greatly helpful if you could provide an example code where this exception happens for more accurate testing. 😀

MTtankkeo commented 3 weeks ago

Try updating to version 2.2.2 to see if the issue is resolved. (Since the structure differs from version 1.0, you may need to modify your existing code.)

jitender-skycap commented 1 week ago

Try updating to version 2.2.2 to see if the issue is resolved. (Since the structure differs from version 1.0, you may need to modify your existing code.)

@MTtankkeo , thanks for update, I had updated the version. Lets see after release.

jitender-skycap commented 1 week ago

Thanks for reporting this issue. It seems that the RenderBox being null is an extremely rare situation, which is why there is no exception handling for it. Even in the latest version, this issue could still occur, so it’s important to address it. However, it would be greatly helpful if you could provide an example code where this exception happens for more accurate testing. 😀

@MTtankkeo , Actually this happen for iOS user only(not for android) in live app, I'm not able to reproduce it in debug mode, so can't explain much about the code.

jitender-skycap commented 1 week ago

@MTtankkeo, I got one more crash related to this, on android device. Even this is related to other dependency (animated_list_plus) but, it might be helpful in providing you more detail.

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown . at AnimationController.stop(animation_controller.dart:853) at AnimationController._animateToInternal(animation_controller.dart:677) at AnimationController.reverse(animation_controller.dart:537) at TouchRippleSpreadingEffect.cancel(touch_ripple_effect.dart:142) at TouchRippleSpreadingEffect.onRejected(touch_ripple_effect.dart:161) at _TouchRippleGestureDetectorState.initBuilders..(touch_ripple_gesture_detector.dart:235) at TouchRippleTapGestureRecognizer.rejectGesture(touch_ripple_gesture_recognizer.dart:296) at GestureArenaManager._resolve(arena.dart:240) at GestureArenaEntry.resolve(arena.dart:55) at OneSequenceGestureRecognizer.resolve(recognizer.dart:451) at TouchRippleGestureRecognizer.reject(touch_ripple_gesture_recognizer.dart:114) at TouchRippleGestureRecognizer.handleEvent(touch_ripple_gesture_recognizer.dart:93) at PointerRouter._dispatch(pointer_router.dart:98) at PointerRouter._dispatchEventToRoutes.(pointer_router.dart:143) at _LinkedHashMapMixin.forEach(dart:collection) at PointerRouter._dispatchEventToRoutes(pointer_router.dart:141) at PointerRouter.route(pointer_router.dart:127) at GestureBinding.handleEvent(binding.dart:501) at GestureBinding.dispatchEvent(binding.dart:481) at RendererBinding.dispatchEvent(binding.dart:450) at GestureBinding._handlePointerEventImmediately(binding.dart:426) at GestureBinding.handlePointerEvent(binding.dart:389) at GestureBinding._flushPointerEventQueue(binding.dart:336) at GestureBinding._handlePointerDataPacket(binding.dart:305)

Screenshot 2024-11-11 at 1 24 28 PM

MTtankkeo commented 1 week ago

Thanks, It appears that the related reorderable list package may be dynamically moving items or changing widget tree positions, which is causing unexpected exceptions related to the AnimationController. I believe I can address this by implementing additional exception handling to resolve the issue.

i will soon release version 2.2.3 with a fix or improvement for this issue.

MTtankkeo commented 5 days ago

@MTtankkeo, I got one more crash related to this, on android device. Even this is related to other dependency (animated_list_plus) but, it might be helpful in providing you more detail.

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown . at AnimationController.stop(animation_controller.dart:853) at AnimationController._animateToInternal(animation_controller.dart:677) at AnimationController.reverse(animation_controller.dart:537) at TouchRippleSpreadingEffect.cancel(touch_ripple_effect.dart:142) at TouchRippleSpreadingEffect.onRejected(touch_ripple_effect.dart:161) at _TouchRippleGestureDetectorState.initBuilders..(touch_ripple_gesture_detector.dart:235) at TouchRippleTapGestureRecognizer.rejectGesture(touch_ripple_gesture_recognizer.dart:296) at GestureArenaManager._resolve(arena.dart:240) at GestureArenaEntry.resolve(arena.dart:55) at OneSequenceGestureRecognizer.resolve(recognizer.dart:451) at TouchRippleGestureRecognizer.reject(touch_ripple_gesture_recognizer.dart:114) at TouchRippleGestureRecognizer.handleEvent(touch_ripple_gesture_recognizer.dart:93) at PointerRouter._dispatch(pointer_router.dart:98) at PointerRouter._dispatchEventToRoutes.(pointer_router.dart:143) at _LinkedHashMapMixin.forEach(dart:collection) at PointerRouter._dispatchEventToRoutes(pointer_router.dart:141) at PointerRouter.route(pointer_router.dart:127) at GestureBinding.handleEvent(binding.dart:501) at GestureBinding.dispatchEvent(binding.dart:481) at RendererBinding.dispatchEvent(binding.dart:450) at GestureBinding._handlePointerEventImmediately(binding.dart:426) at GestureBinding.handlePointerEvent(binding.dart:389) at GestureBinding._flushPointerEventQueue(binding.dart:336) at GestureBinding._handlePointerDataPacket(binding.dart:305)

Screenshot 2024-11-11 at 1 24 28 PM

@jitender-skycap A version 2.2.3 has been released to address this issue. Please update to the latest version and check if the exception still occurs.

jitender-skycap commented 5 days ago

@MTtankkeo, I got one more crash related to this, on android device. Even this is related to other dependency (animated_list_plus) but, it might be helpful in providing you more detail. Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown . at AnimationController.stop(animation_controller.dart:853) at AnimationController._animateToInternal(animation_controller.dart:677) at AnimationController.reverse(animation_controller.dart:537) at TouchRippleSpreadingEffect.cancel(touch_ripple_effect.dart:142) at TouchRippleSpreadingEffect.onRejected(touch_ripple_effect.dart:161) at _TouchRippleGestureDetectorState.initBuilders..(touch_ripple_gesture_detector.dart:235) at TouchRippleTapGestureRecognizer.rejectGesture(touch_ripple_gesture_recognizer.dart:296) at GestureArenaManager._resolve(arena.dart:240) at GestureArenaEntry.resolve(arena.dart:55) at OneSequenceGestureRecognizer.resolve(recognizer.dart:451) at TouchRippleGestureRecognizer.reject(touch_ripple_gesture_recognizer.dart:114) at TouchRippleGestureRecognizer.handleEvent(touch_ripple_gesture_recognizer.dart:93) at PointerRouter._dispatch(pointer_router.dart:98) at PointerRouter._dispatchEventToRoutes.(pointer_router.dart:143) at _LinkedHashMapMixin.forEach(dart:collection) at PointerRouter._dispatchEventToRoutes(pointer_router.dart:141) at PointerRouter.route(pointer_router.dart:127) at GestureBinding.handleEvent(binding.dart:501) at GestureBinding.dispatchEvent(binding.dart:481) at RendererBinding.dispatchEvent(binding.dart:450) at GestureBinding._handlePointerEventImmediately(binding.dart:426) at GestureBinding.handlePointerEvent(binding.dart:389) at GestureBinding._flushPointerEventQueue(binding.dart:336) at GestureBinding._handlePointerDataPacket(binding.dart:305) Screenshot 2024-11-11 at 1 24 28 PM

@jitender-skycap A version 2.2.3 has been released to address this issue. Please update to the latest version and check if the exception still occurs.

Thanks, @MTtankkeo , will update the sdk and update you after releasing new app version.