root property

String? get root

Implementation

String? get root {
  var directory = fs.currentDirectory.absolute;

  while (directory.path != p.separator) {
    final file = directory.childFile('pubspec.yaml');

    if (file.existsSync()) {
      return directory.path;
    }

    directory = directory.parent;
  }

  return null;
}