projectPubspecLock property

FutureOr<Map<String, dynamic>> get projectPubspecLock

The resolved project pubspec.lock file as YamlMap.

Implementation

FutureOr<Map<String, dynamic>> get projectPubspecLock {
  var projLockFile = _projectLockFile;
  if (projLockFile == null) {
    return projectPubspecLockFile.resolveMapped((lockFile) {
      if (!lockFile.existsSync()) {
        throw StateError(
            'No `pubspec.lock` file in project directory `$projectDirectory`. Run `pub get`.');
      }

      final yaml = loadYaml(lockFile.readAsStringSync()) as YamlMap;
      var projectLockFile = yaml.cast<String, dynamic>();

      _projectLockFile = projectLockFile;

      log('INFO', 'Resolved `projectPubspecLock`: $projectLockFile');

      return projectLockFile;
    });
  } else {
    return projLockFile;
  }
}