getPubspecLock function Null safety

PubspecLock getPubspecLock()

Reads pubspec.lock from main directory and creates PubspecLock

Implementation

PubspecLock getPubspecLock() {
  try {
    final fileContent = File('pubspec.lock').readAsStringSync();
    return PubspecLock(fileContent);
  } on FileSystemException catch (_) {
    return PubspecLock('');
  }
}