initAppPackageName static method

void initAppPackageName()

Initializes the app package name by reading it from pubspec.yaml.

Implementation

static void initAppPackageName() {
  const pubspecFileName = 'pubspec.yaml';
  const searchString = 'name:';

  final pubspecFile = File(path.join(
    Utils.projectDirectory,
    pubspecFileName,
  ));
  for (final line in pubspecFile.readAsLinesSync()) {
    if (line.contains(searchString)) {
      appPackageName = line.split(searchString).last.trim();
    }
  }
}