diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index e8d4e194754d08c9696576e0bbb799a1c765875d..e739bd0ca3b75844e594e1eebc9292a408cf6e8c 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -12,14 +12,14 @@ publish_to: none
 
 environment:
   # sdk: '>=2.8.0 <3.0.0'
-  sdk: '>=2.12.0-259.8.beta <3.0.0'
+  sdk: '>=2.17.0 <3.0.0'
 
 dependencies:
   flutter:
     sdk: flutter
   screenshot:
     path: ../
-  cupertino_icons: ^0.1.2
+  cupertino_icons: ^1.0.2
   # image_gallery_saver: ^1.1.0
 
 dev_dependencies:
diff --git a/lib/screenshot.dart b/lib/screenshot.dart
index 75fcaafa4a681a72bb2305eaef6d3756114b1dae..fc1111439283b61e081eb34ffed1d6efb956fff0 100644
--- a/lib/screenshot.dart
+++ b/lib/screenshot.dart
@@ -117,7 +117,7 @@ class ScreenshotController {
 
   static Future<ui.Image> widgetToUiImage(
     Widget widget, {
-    Duration delay: const Duration(seconds: 1),
+    Duration delay = const Duration(seconds: 1),
     double? pixelRatio,
     BuildContext? context,
     Size? targetSize,
@@ -149,7 +149,7 @@ class ScreenshotController {
     final RenderRepaintBoundary repaintBoundary = RenderRepaintBoundary();
 
     Size logicalSize = targetSize ??
-        ui.window.physicalSize / ui.window.devicePixelRatio; // Adapted
+        View.of(context!).physicalSize / ui.window.devicePixelRatio; // Adapted
     Size imageSize = targetSize ?? ui.window.physicalSize; // Adapted
 
     assert(logicalSize.aspectRatio.toStringAsPrecision(5) ==
@@ -157,13 +157,13 @@ class ScreenshotController {
             .toStringAsPrecision(5)); // Adapted (toPrecision was not available)
 
     final RenderView renderView = RenderView(
-      window: ui.window,
+      
       child: RenderPositionedBox(
           alignment: Alignment.center, child: repaintBoundary),
       configuration: ViewConfiguration(
         size: logicalSize,
         devicePixelRatio: pixelRatio ?? 1.0,
-      ),
+      ), view: View.of(context!),
     );
 
     final PipelineOwner pipelineOwner = PipelineOwner();
diff --git a/pubspec.yaml b/pubspec.yaml
index e31d93e8914887eee98e202fa5407af7099d7630..9e06f82581c6c71de3620129e24c645aa5dc8e69 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,7 +4,7 @@ version: 1.3.0
 homepage: https://github.com/SachinGanesh/screenshot
 
 environment:
-  sdk: '>=2.12.0 <3.0.0'
+  sdk: '>=2.17.0 <3.0.0'
   # sdk: '>=2.12.0-259.8.beta <3.0.0'
 
 # analyzer: