getResourceUrl static method
Get resource URL from a path (same method as solidpod).
resourcePath - Path to the resource (e.g., 'geopod/data/places').
isContainer - Whether this is a directory (adds trailing slash).
Implementation
static Future<String> getResourceUrl(
String resourcePath, {
bool isContainer = false,
}) async {
final webId = await getWebId();
if (webId == null || webId.isEmpty) {
throw Exception('User not logged in: cannot access resource URL');
}
if (!webId.contains(_profCard)) {
throw Exception('Invalid webId format: must contain $_profCard');
}
final resourceUrl = webId.replaceAll(_profCard, resourcePath);
if (isContainer && !resourceUrl.endsWith('/')) {
return '$resourceUrl/';
}
return resourceUrl;
}