extractPath static method

String extractPath(
  1. String url
)

Extract the path from a full URL

Implementation

static String extractPath(String url) {
  try {
    final uri = Uri.parse(url);
    return uri.path.isEmpty ? '/' : uri.path;
  } catch (_) {
    return url;
  }
}