takeScreenshot method Null safety
- String screenshotName
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) async {
reportData ??= <String, dynamic>{};
reportData!['screenshots'] ??= <dynamic>[];
final Map<String, dynamic> data = await callbackManager.takeScreenshot(screenshotName);
assert(data.containsKey('bytes'));
(reportData!['screenshots']! as List<dynamic>).add(data);
return data['bytes']! as List<int>;
}