exportLastCapture static method

Future<File> exportLastCapture()

Exports the latest completed capture in this process as a USDZ file.

Implementation

static Future<File> exportLastCapture() async {
  if (!Platform.isIOS) throw UnsupportedError('USDZ export requires iOS.');
  final path = await _channel.invokeMethod<String>('exportLastCapture');
  if (path == null || path.trim().isEmpty) {
    throw StateError('No exported model path was returned.');
  }
  final file = File(path);
  if (!await file.exists()) {
    throw FileSystemException('The exported 3D model was not created.', path);
  }
  if (await file.length() == 0) {
    throw FileSystemException('The exported 3D model is empty.', path);
  }
  return file;
}