download method

Future<Uint8List> download()

Downloads the image file bytes from the PocketBase server.

This method uses the client.files.get method from the PocketBase SDK, which is expected to handle caching and network policies.

Implementation

Future<Uint8List> download() async {
  // The image provider's entire cache/network logic is now handled by the FileService.
  // We use a network-first policy by default for images to ensure they are up-to-date.
  return client.files.getFileData(
    recordId: recordId,
    recordCollectionName: recordCollectionName,
    filename: filename,
    token: token,
    autoGenerateToken: autoGenerateToken,
    requestPolicy: RequestPolicy.cacheAndNetwork,
    expireAfter: expireAfter,
  );
}