NormalizedPath class

Represents a URL path that has been normalized.

Normalization includes:

  • Resolving . and .. segments.
  • Removing empty segments caused by multiple consecutive slashes.
  • Ensuring the path starts with a /.

Instances are interned using an LRU cache for efficiency, meaning identical normalized paths will often share the same object instance.

Annotations

Constructors

NormalizedPath(String path)
Creates a NormalizedPath from a given path string.
factory

Properties

hashCode int
The hash code for this normalized path, based on its segments.
latefinal
hasParameters bool
Whether path has parameters or not
latefinal
length int
The number of segments in this path
no setter
path String
The string representation of the normalized path, always starting with /.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
segments List<String>
The individual segments of the normalized path. For example, the path /a/b/c would have segments ['a', 'b', 'c'].
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subPath(int start, [int? end]) NormalizedPath
Returns a new NormalizedPath representing a subpath of this path.
toString() String
Returns the normalized path string.
override

Operators

operator ==(Object other) bool
Compares this NormalizedPath to another object for equality.
override

Static Properties

empty NormalizedPath
Empty normalized path instance.
getter/setter pair
interned LruCache<String, NormalizedPath>
Cache of interned instances
getter/setter pair