takeScreenshot method
Takes a screenshot.
On Android, you need to call convertFlutterSurfaceToImage()
, and
pump a frame before taking a screenshot.
Implementation
Future<List<int>> takeScreenshot(String screenshotName, [Map<String, Object?>? args]) async {
reportData ??= <String, dynamic>{};
reportData!['screenshots'] ??= <dynamic>[];
final Map<String, dynamic> data = await callbackManager.takeScreenshot(screenshotName, args);
assert(data.containsKey('bytes'));
(reportData!['screenshots']! as List<dynamic>).add(data);
return data['bytes']! as List<int>;
}