toFileData static method

Future<UFileData> toFileData(
  1. UCapturedPhoto photo
)

Wraps a captured photo as the UFileData the rest of the package passes around, so camera output flows through uploads and pickers unchanged.

Implementation

static Future<UFileData> toFileData(UCapturedPhoto photo) async => UFileData(
  bytes: photo.bytes ?? await _readBytes(photo.path),
  name: "${path.basenameWithoutExtension(photo.path ?? "photo")}.${photo.extension}",
  extension: photo.extension,
);