getPublicUrl method

Future<Uri?> getPublicUrl({
  1. required String storageId,
  2. required String path,
})

Gets the public URL for a file, if the storageId is a public storage.

Implementation

Future<Uri?> getPublicUrl({
  required String storageId,
  required String path,
}) async {
  var storage = _session.server.serverpod.storage[storageId];
  if (storage == null) {
    throw CloudStorageException('Storage $storageId is not registered');
  }

  return await storage.getPublicUrl(session: _session, path: path);
}