'How to capture widget that is not in tree using compute function?
I use screenshot to capture widget that is not in tree and works. But if I try to capture complex and high resolution widget it freezes the UI for a while. Then I use isolated thread/compute function.
This is simple code you can try to reproduce.
Future<Uint8List>captureWidget(String value) async {
ScreenshotController screenshotController = ScreenshotController();
return await screenshotController.captureFromWidget(Text(value));
}
then call
Uint8List capturedWidget = await compute(captureWidget,"Test");
I got this error
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Exception: 'dart:ui/window.dart': Failed assertion: line 298 pos 12: '<optimized out>': is not true.
Is possible to capture widget that is not in tree using isolate thread?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
