validateProjectDirectory method

Future<bool> validateProjectDirectory()

Implementation

Future<bool> validateProjectDirectory() async {
  final dir = Directory(projectDirectory);

  if (!await dir.exists()) {
    logger.err('Directory not found: $projectDirectory');
    return false;
  }

  final pubspecFile = File(path.join(projectDirectory, 'pubspec.yaml'));
  if (!await pubspecFile.exists()) {
    logger.err('No pubspec.yaml found in: $projectDirectory');
    logger.info('Make sure you are in a Dart or Flutter project directory.');
    return false;
  }

  return true;
}