isNestedSpmPath function
Returns true if the given packageSwiftPath is in a nested Flutter 3.41+
layout (ios/<name>/Package.swift) rather than the flat ios/Package.swift.
Implementation
bool isNestedSpmPath(String packageSwiftPath) {
// Count path segments: flat has parent = ios/, nested has parent = ios/<name>/
final parent = p.dirname(packageSwiftPath);
final grandParent = p.dirname(parent);
return p.basename(grandParent) == 'ios' || p.basename(grandParent) == 'macos';
}