findTargets static method
Finds all cache targets in a Flutter project.
projectRoot is the absolute path to the project root.
includeOptional includes optional targets if true.
Implementation
static List<CacheTarget> findTargets(
String projectRoot, {
bool includeOptional = false,
}) {
final targets = <CacheTarget>[];
// Required targets
for (final targetName in requiredTargets) {
final target = _findTarget(projectRoot, targetName);
if (target != null) {
targets.add(target);
}
}
// Optional targets
if (includeOptional) {
for (final targetName in optionalTargets) {
final target = _findTarget(projectRoot, targetName);
if (target != null) {
targets.add(target);
}
}
}
return targets;
}