capture method

Future<void> capture(
  1. String name
)

Implementation

Future<void> capture(String name) async {
  if (device == null) return;

  final image = await device!.screenshot();
  final file = [device!.state.name, ...suffixes, '$name.png'].join('_');
  final basePath =
      device!.state.platform == DevicePlatform.ios ? iosPath : androidPath;
  final filePath = path.join(basePath, file);

  await Directory(basePath).create(recursive: true);
  await File(filePath).writeAsBytes(image);
}