appName property

String get appName

the name: of the app pubspec.yaml, for package:<app>/... imports

Implementation

String get appName {
  RegExpMatch? match = RegExp(
    r'^name:\s*(\S+)',
    multiLine: true,
  ).firstMatch(_file('pubspec.yaml').readAsStringSync());
  if (match == null) throw StateError('pubspec.yaml has no name.');
  return match.group(1)!;
}