of static method

Package? of(
  1. Directory directory
)

Implementation

static Package? of(Directory directory) {
  try {
    final pubspec = _pubspec(directory);
    if (pubspec != null) {
      return Package(
        directory: directory,
        name: pubspec.name,
        pubspec: pubspec,
        currentVersion: pubspec.version ?? Version(0, 0, 0),
        originalVersion: pubspec.version ?? Version(0, 0, 0),
      );
    } else {
      return null;
    }
  } on Object catch (_) {
    log('Cannot recognize package at "${directory.path}"');
    return null;
  }
}