writeRenderProgress function

void writeRenderProgress(
  1. String path,
  2. int completed,
  3. int total
)

Writes "<completed>/<total>" to path atomically, for a launcher polling a render's progress.

A sibling .tmp file is written then renamed over path, so a concurrent reader always sees a whole count, never a half-written one. Pass this as renderVideo(onProgress:) when the host wired a progress file.

Implementation

void writeRenderProgress(String path, int completed, int total) {
  File('$path.tmp')
    ..writeAsStringSync('$completed/$total', flush: true)
    ..renameSync(path);
}