isNestedSpmLayout function

bool isNestedSpmLayout(
  1. String packageSwiftPath
)

Checks if a Package.swift uses the Flutter 3.41+ nested layout.

Implementation

bool isNestedSpmLayout(String packageSwiftPath) {
  final file = File(packageSwiftPath);
  if (!file.existsSync()) return false;

  final content = file.readAsStringSync();
  // Flutter 3.41+ nested layout uses Sources/ directory structure
  return content.contains('Sources/') || content.contains('path: "Sources/');
}