jhomlala / catcher

Flutter error catching & handling plugin. Handles and reports exceptions in your app!
Apache License 2.0
784 stars 175 forks source link

[BUG] Failed to create screenshot file: type 'Null' is not a subtype of type 'RenderRepaintBoundary' in type cast #219

Closed maciejpos closed 10 months ago

maciejpos commented 2 years ago

While running screenshot_example.dart the following warning appears:

I/flutter (14672): [2022-05-21 22:11:16.240335 | Catcher | WARNING] Failed to create screenshot file: type 'Null' is not a subtype of type 'RenderRepaintBoundary' in type cast

-> as a result, no screenshot is created.

Interestingly, after [hot restart] - the warning disappears and the screenshot is created properly.

After debuging, it occured the problem is that currentContext?.findRenderObject() is called on Null (see: lib/core/catcher_screenshot_manager.dart).

To Reproduce

  1. Run screenshot_example.dart
  2. See Warning: I/flutter (14672): [2022-05-21 22:11:16.240335 | Catcher | WARNING] Failed to create screenshot file: type 'Null' is not a subtype of type 'RenderRepaintBoundary' in type cast
  3. Run screenshot_example.dart with [Hot restart]
  4. No Warning, screenshot is created correctly.

Expected behavior Screenshot is created correctly every time.

Flutter doctor [√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19044.1706], locale en-GB) [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.8) [√] Android Studio (version 2021.2) [√] IntelliJ IDEA Ultimate Edition (version 2022.1) [√] VS Code (version 1.66.0) [√] Connected device (5 available) [√] HTTP Host Availability

• No issues found!

Catcher version

Smartphone (please complete the following information):

jhomlala commented 10 months ago

Please update to version 0.8.0.