normalizeEmptyPath method

Uri normalizeEmptyPath()

Similar to normalizePath but it will also remove empty pathSegments.

Implementation

Uri normalizeEmptyPath() {
  final normalized = normalizePath();
  if (normalized.path.endsWith('/')) {
    return normalized.replace(pathSegments: normalized.pathSegments.where((s) => s.isNotEmpty));
  }

  return normalized;
}