Flutter error “Multiple widgets used the same GlobalKey” – using ScreenShot with SocialShare plugins

Turns out I had to make the Screenshot controller local and put it here;

Widget createViewItem() {
   ScreenshotController _screenshotController = ScreenshotController();
    return Screenshot(
    controller: screenshotController,
          Column(
             children: <Widget>[
              child: Image.network( myavatar),
              child: IconButton(
                 icon: Icon(Icons.share),
                onPressed: () async {
                   await screenshotController.capture().then((image) async {
                   SocialShare.shareOptions("http://myurl", imagePath: image.path);
                      }
                   );
                 },
              ),
          ],
       ),
    ),
}

 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top