On the home screen on my app :

  • I have a list view with a bunch of card widgets and a screenshot action associated with each card widget. When I click on the screenshot action it captures the screenshot of that widget as it’s supposed to.
  • I have a floating action button which when clicked takes me to an add screen where I add data and save it to the database. Once saved a snackbar message is displayed and screen is popped out. The list view now displays the new record as a card widget.

PROBLEM :

  • After adding the record, when I click the screenshot action no widget screenshot is captured and on debugging I noticed the “Uint8List? image” is null.
  • Now if I scroll the list view and perform the screenshot action again everything seems to work.

It sounds to me that this might be a widget tree rebuild issue, but I am not sure how to go about with it. I have other actions, edit and delete on the card widget and they work without any issue.

Package used: screenshot 1.2.3