pathFromGoogleStorageUrl function

String pathFromGoogleStorageUrl(
  1. String url
)

Returns a path from a given gs:// URL.

If no path exists, the root path will be returned.

Implementation

String pathFromGoogleStorageUrl(String url) {
  assert(url.startsWith('gs://'));
  int stopIndex = url.indexOf('/', 5);
  if (stopIndex == -1) return '/';
  return url.substring(stopIndex + 1, url.length);
}