takeSnapshot method

Future<void> takeSnapshot()

Pauses the video and saves a snapshot in the desired location.

Implementation

Future<void> takeSnapshot() async {
  Snapshot? snapshot = await getSnapshot();
  if (snapshot != null) {
    String? userPath = await FilePicker.platform
        .saveFile(fileName: "${snapshot.name}.${snapshot.format}");
    if (userPath != null) {
      File(userPath).writeAsBytes(snapshot.image, flush: true);
    }
  }
}