parseExportFormat function

Export? parseExportFormat(
  1. String? format
)

The Export for a --format value, or null (the mp4 default) for null/empty/mp4.

A capture harness reads --format as a string (a --dart-define carries no types), so the mapping lives here rather than in each harness — the CLI, the Playground, and the example gallery all parse it the same way or they render different files for the same flag.

Throws an ArgumentError naming the value when it is not a known format.

Implementation

Export? parseExportFormat(String? format) => switch (format) {
  null || '' || 'mp4' => null,
  'gif' => const Export.gif(),
  'imageSequence' => const Export.imageSequence(),
  'transparent' => const Export.transparent(),
  _ => throw ArgumentError.value(format, 'format', 'unknown export format'),
};