screenshot
screenshot copied to clipboard
Memory not releasing while converting StatefulWidget with 4 high quality Image.memory used inside
When I try to get screenshoot of StatefulWidget with 4 high quality Image.memory used inside, StatefulWidgets dispose method not working and it is not clearing Images from memory. Any fix?
--- a/lib/screenshot.dart
+++ b/lib/screenshot.dart
@@ -246,7 +246,10 @@ class ScreenshotController {
///
} while (isDirty && retryCounter >= 0);
-
+ rootElement.visitChildren((Element element) {
+ rootElement.deactivateChild(element);
+ });
+ buildOwner.finalizeTree();
return image; // Adapted to directly return the image and not the Uint8List
}
}
Same problem. Any fork available with this fix?