google / flutter.widgets

https://pub.dev/packages/flutter_widgets
BSD 3-Clause "New" or "Revised" License
1.36k stars 471 forks source link

[visibility_detector] _CastError: Null check operator used on a null value #328

Open thecodepapaya opened 2 years ago

thecodepapaya commented 2 years ago

Problem description

Package: visibility_detector Getting null check errors for the visibility_detector package. Check stack trace for more details.

Environment

Emulator: Pixel 4, Google APIs enabled, Android OS version 12.0

Additional details

_CastError: Null check operator used on a null value
  File "layer.dart", line 2282, in LeaderLayer.applyTransform
  File "visibility_detector_layer.dart", line 37, in _accumulateTransforms
  File "visibility_detector_layer.dart", line 53, in _localRectToGlobal
  File "visibility_detector_layer.dart", line 121, in VisibilityDetectorLayer._computeWidgetBounds
  File "visibility_detector_layer.dart", line 227, in VisibilityDetectorLayer._processCallbacks
  File "binding.dart", line 85, in _TaskEntry.run
  File "binding.dart", line 458, in SchedulerBinding.handleEventLoopCallback
  File "binding.dart", line 435, in SchedulerBinding._runTasks
  File "zone.dart", line 1420, in _rootRun
  File "zone.dart", line 1328, in _CustomZone.run
  File "zone.dart", line 1236, in _CustomZone.runGuarded
  File "zone.dart", line 1276, in _CustomZone.bindCallbackGuarded.<fn>
  File "zone.dart", line 1428, in _rootRun
  File "zone.dart", line 1328, in _CustomZone.run
  File "zone.dart", line 1260, in _CustomZone.bindCallback.<fn>
  File "semantics.dart", line 3249, in SemanticsConfiguration._addArgumentlessAction.<fn>
  File "timer_impl.dart", line 395, in _Timer._runTimers
  File "timer_impl.dart", line 426, in _Timer._handleMessage
  File "isolate_patch.dart", line 192, in _RawReceivePortImpl._handleMessage
jamesderlin commented 2 years ago

How reproducible is this? Do you have a reproduction case?

jamesderlin commented 2 years ago

Also, which version of Flutter are you using?

jamesderlin commented 2 years ago

I suspect that this might be fixed by https://github.com/flutter/flutter/pull/96144. Can you possibly see if this still happens with a version of Flutter from its master branch?

thecodepapaya commented 2 years ago

Also, which version of Flutter are you using?


[✓] Flutter (Channel unknown, 2.8.1, on Ubuntu 21.10 5.13.0-28-generic, locale en_IN)
• Flutter version 2.8.1 at /home/ashutosh/snap/flutter/common/flutter
• Upstream repository unknown
• Framework revision 77d935af4d (8 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /home/ashutosh/Android/Sdk • Platform android-32, build-tools 32.1.0-rc1 • ANDROID_SDK_ROOT = /home/ashutosh/Android/Sdk • Java binary at: /snap/android-studio/118/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted.

[✓] Chrome - develop for the web • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) • cmake version 3.10.2 • ninja version 1.8.2 • pkg-config version 0.29.1

[✓] Android Studio (version 2021.1) • Android Studio at /snap/android-studio/118/android-studio • Flutter plugin version 64.0.2 • Dart plugin version 211.7798 • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.64.0) • VS Code at /usr/share/code • Flutter extension version 3.34.0

[✓] Connected device (3 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator) • Linux (desktop) • linux • linux-x64 • Ubuntu 21.10 5.13.0-28-generic • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80

• No issues found!

thecodepapaya commented 2 years ago

How reproducible is this? Do you have a reproduction case?

I'm able to reproduce this bug in my code when the widget under VisibilityDetector is being partially hid behind a bottom sheet and reconstructed. Will try to provide a minimum reproducible code.

jamesderlin commented 2 years ago

Before you go through the effort of making a reproduction case, if you can, please check if it's already been fixed on Flutter's master branch.

HayesGordon commented 2 years ago

Hi @jamesderlin users of our package reported similar issues: https://github.com/GetStream/stream-chat-flutter/issues/856

I just tried the master branch and that solved it for me, thank you.