packageNameFromPubspec static method

String packageNameFromPubspec(
  1. String content
)

Reads a package name from the pubspec text already loaded by the patcher.

Implementation

static String packageNameFromPubspec(String content) {
  final dynamic document = loadYaml(content);
  if (document is! YamlMap || document['name'] is! String) {
    throw StateError('Could not read package name from pubspec.yaml');
  }
  return document['name'] as String;
}