W3cubDocs

/Dart 2

isAbsolute property

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('/');
  }
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-io/FileSystemEntity/isAbsolute.html