isAbsolute method

bool isAbsolute (String path)

Returns true if path is an absolute path and false if it is a relative path.

On POSIX systems, absolute paths start with a / (forward slash). On Windows, an absolute path starts with \\, or a drive letter followed by :/ or :\. For URLs, absolute paths either start with a protocol and optional hostname (e.g. http://dartlang.org, file://) or with a /.

URLs that start with / are known as "root-relative", since they're relative to the root of the current URL. Since root-relative paths are still absolute in every other sense, isAbsolute will return true for them. They can be detected using isRootRelative.

Implementation

bool isAbsolute(String path) => style.rootLength(path) > 0;