SachinGanesh/screenshot

FlutterError (View.of() was called with a context that does not contain a View widget.

mgeilich opened this issue · 4 comments

Received this when calling captureFromWidget(), why?

Exception has occurred.
FlutterError (View.of() was called with a context that does not contain a View widget.
No View widget ancestor could be found starting from the context that was passed to View.of().
The context used was:
Scrollable(axisDirection: down, physics: null, restorationId: null, dirty, state: ScrollableState#828ca(lifecycle state: initialized, position: null, effective physics: null))
This usually means that the provided context is not associated with a View.)

Same issue post flutter update.

Pass context parameter from build context must solve the issue
await screenshotController
.captureFromWidget(_widget,
context: context,

It's not work

passing context worked here.