writeMemoryVideoToFile function

Future<File> writeMemoryVideoToFile(
  1. Uint8List bytes,
  2. String filePath
)

Writes a video file from memory to the specified file path.

This function takes a Uint8List of bytes representing the video data and writes it to a file at the given filePath. The file is flushed to ensure all data is written to disk before returning.

  • Parameters:

    • bytes: The video data in memory as a Uint8List.
    • filePath: The path where the video file should be written.
  • Returns: A Future that resolves to the File object representing the written file.

  • Throws: An IOException if the file cannot be written. be written.

Implementation

Future<File> writeMemoryVideoToFile(Uint8List bytes, String filePath) async {
  final file = File(filePath);

  await file.writeAsBytes(
    bytes,
    flush: true,
  );

  return file;
}