我想知道是否可以捕获webview的图像?

这是我尝试过的:

例如_64446:

static GlobalKey previewContainer = new GlobalKey();
   ...            
                new RaisedButton(
                  onPressed: takeScreenShot,
                  child: const Text('Take a Screenshot'),
                ),
  ...
   takeScreenShot() async{
        RenderRepaintBoundary boundary = previewContainer.currentContext.findRenderObject();
        ui.Image image = await boundary.toImage();
        final directory = (await getApplicationDocumentsDirectory()).path;
        ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
        Uint8List pngBytes = byteData.buffer.asUint8List();
        File imgFile = new File(directory+'/screenshot.png');
        imgFile.writeAsBytes(pngBytes);

        //then, save the png image file in Firebase storage : OKAY
  }

首先,我尝试制作一个简单材质按钮的打印屏幕: OKAY, it works

RepaintBoundary(
            key: previewContainer,
            child: 
                MaterialButton(
                     child: const Text('Test'),
                     textColor: Colors.white,
                    color: Colors.blue,

                ),
            ),

但是当我尝试制作webview的打印屏幕时,它不起作用,保存的图像为空(只有几个字节):

RepaintBoundary(
            key: previewContainer,
            child: 
              new SizedBox(
                    height: 280.0,
                    width: 280.0,
                    child: WebView(
                      initialUrl: 'https://flutter.io',
                      javaScriptMode: JavaScriptMode.unrestricted,
                      onWebViewCreated: (WebViewController webViewController)                    {
                        _controller.complete(webViewController);
                      },
                    )
               ),
             )

任何的想法?

还是有另一种方法比RepaintBoundary捕获png图像?