content method

(Uint8List, String) content(
  1. String principalId,
  2. String fileId,
  3. String variant
)

The bytes and type of variant (original or a thumbnail) of fileId for principalId (12 9.3).

Throws 404, 409 file_not_ready with Retry-After while the check runs and 409 file_blocked for a blocked or failed file; 404 for a variant the file lacks.

Implementation

(Uint8List, String) content(
  String principalId,
  String fileId,
  String variant,
) {
  final f = visibleFile(principalId, fileId);
  _requireServable(f);
  if (variant == 'original') {
    return (f.bytes!, f.json['mime_type']! as String);
  }
  final thumb = f.thumbnails[variant];
  if (thumb == null) throw const FakeProblem(404, 'not_found');
  return (thumb, f.json['mime_type']! as String);
}