detectTechStack static method

List<String> detectTechStack([
  1. String root = '.'
])

Implementation

static List<String> detectTechStack([String root = '.']) {
  final stack = <String>[];

  // Dart/Flutter
  if (FileService.fileExists('$root/pubspec.yaml')) {
    stack.add('Dart');
    // Check if Flutter
    try {
      final pubspec = FileService.readFile('$root/pubspec.yaml');
      if (pubspec.contains('flutter:')) {
        stack.add('Flutter');
      }
    } catch (e) {
      // Ignore
    }
  }

  // Node.js
  if (FileService.fileExists('$root/package.json')) {
    stack.add('Node.js');
  }

  // Python
  if (FileService.fileExists('$root/requirements.txt') ||
      FileService.fileExists('$root/pyproject.toml')) {
    stack.add('Python');
  }

  // Rust
  if (FileService.fileExists('$root/Cargo.toml')) {
    stack.add('Rust');
  }

  // Java
  if (FileService.fileExists('$root/pom.xml') ||
      FileService.fileExists('$root/build.gradle')) {
    stack.add('Java');
  }

  return stack;
}