isAbsolute property Null safety

bool isAbsolute

Returns a bool indicating whether this object's path is absolute.

On Windows, a path is absolute if it starts with \\ or a drive letter between a and z (upper or lower case) followed by :\ or :/. On non-Windows, a path is absolute if it starts with /.

Implementation

bool get isAbsolute {
  if (Platform.isWindows) {
    return path.startsWith(_absoluteWindowsPathPattern);
  } else {
    return path.startsWith('/');
  }
}