aloisdeniel / flutter_device_preview

Approximate how your app looks and performs on another device.
https://aloisdeniel.github.io/flutter_device_preview/
MIT License
2.21k stars 343 forks source link

DevicePreview.screenshot throws Error: Unexpected null value #215

Open JonasJW opened 1 year ago

JonasJW commented 1 year ago

I'm getting this weird error when calling DevicePreview.screenshot(context). This only happens on one specific page only on the web platform. Other pages work fine and it works on iOS.

I couldn't find any more info while debugging that might explain this error, I only have the following exception. I assume this is not much help to identify the issue but I still want to see if someone has an idea.

Error: Unexpected null value.
../dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49      throw_
../dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 528:63  nullCheck
../lib/_engine/engine/canvaskit/layer.dart 584:34                                    preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 197:38                                    preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 237:38                                    preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 237:38                                    preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 197:38                                    preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../lib/_engine/engine/canvaskit/layer.dart 125:12                                    prerollChildren
../lib/_engine/engine/canvaskit/layer.dart 357:9                                     preroll
../packages/bardogs_flutter/my_app.dart 213:22                                       <fn>
../packages/flutter/src/material/ink_well.dart 1072:21                               handleTap
../packages/flutter/src/gestures/recognizer.dart 253:24                              invokeCallback
../packages/flutter/src/gestures/tap.dart 627:11                                     handleTapUp
../packages/flutter/src/gestures/tap.dart 306:5                                      [_checkUp]
../packages/flutter/src/gestures/tap.dart 239:7                                      handlePrimaryPointer
../packages/flutter/src/gestures/recognizer.dart 615:9                               handleEvent
../packages/flutter/src/gestures/pointer_router.dart 98:12                           [_dispatch]
../packages/flutter/src/gestures/pointer_router.dart 143:9                           <fn>
../dart-sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart 21:13          forEach
../packages/flutter/src/gestures/pointer_router.dart 141:17                          [_dispatchEventToRoutes]
../packages/flutter/src/gestures/pointer_router.dart 127:7                           route
../packages/flutter/src/gestures/binding.dart 460:19                                 handleEvent
../packages/flutter/src/gestures/binding.dart 440:14                                 dispatchEvent
../packages/flutter/src/rendering/binding.dart 337:11                                dispatchEvent
../packages/flutter/src/gestures/binding.dart 395:7                                  [_handlePointerEventImmediately]
../packages/flutter/src/gestures/binding.dart 357:5                                  handlePointerEvent
../packages/flutter/src/gestures/binding.dart 314:7                                  [_flushPointerEventQueue]
../packages/flutter/src/gestures/binding.dart 295:7                                  [_handlePointerDataPacket]
../lib/_engine/engine/platform_dispatcher.dart 1183:13                               invoke1
../lib/_engine/engine/platform_dispatcher.dart 244:5                                 invokeOnPointerDataPacket
../lib/_engine/engine/pointer_binding.dart 147:39                                    [_onPointerData]
../lib/_engine/engine/pointer_binding.dart 653:20                                    <fn>
../lib/_engine/engine/pointer_binding.dart 594:14                                    <fn>
../lib/_engine/engine/pointer_binding.dart 288:16                                    loggedHandler
../lib/_engine/engine/pointer_binding.dart 179:80                                    <fn>
../dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14  _checkAndCall
../dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39  dcall
xalikoutis commented 1 year ago

i believe it is impeller issue. Disable impeller and it should work