[Solved] Failed assertion: line 3180 pos 12: ‘debugNeedsPaint‘: is not true

Click the screenshot of the flitter to call the screenshot method for the first time, and an error is reported
Failed assertion: line 3180 pos 12: ‘debugNeedsPaint’: is not true.

flutter: 'package:flutter/src/rendering/proxy_box.dart': Failed assertion: line 3180 pos 12: '!debugNeedsPaint': is not true.

Solution:
Add a delay call when calling the screenshot method

 onPressed: () {
                Future.delayed(Duration.zero, () {
                  this._capturePng();
                });
              },

Read More: