readDartVersionFromToolVersions static method

String? readDartVersionFromToolVersions(
  1. Iterable<Directory> searchRoots
)

Looks under each directory in searchRoots (in order) for .tool-versions and returns the dart tool version from the first file that defines one.

Returns null if no matching file or dart line is found.

Implementation

static String? readDartVersionFromToolVersions(
  final Iterable<Directory> searchRoots,
) {
  for (final root in searchRoots) {
    final version = _dartVersionFromToolVersionsFileIn(root);
    if (version != null) {
      return version;
    }
  }
  return null;
}