resolveFlutterAndDart<T> method
({Iterable<T> dart, Iterable<T> flutter, Iterable<(DetermineFlutterOrDart, T)> ordered})
resolveFlutterAndDart<T>(
- Iterable<
String> pubspecs, - T getCommandToRun(
- DetermineFlutterOrDart flutterOrDart
- required bool dartOnly,
- required bool flutterOnly,
Implementation
({
Iterable<T> dart,
Iterable<T> flutter,
Iterable<(DetermineFlutterOrDart, T)> ordered,
}) resolveFlutterAndDart<T>(
Iterable<String> pubspecs,
T Function(DetermineFlutterOrDart flutterOrDart) getCommandToRun, {
required bool dartOnly,
required bool flutterOnly,
}) {
final commands = (
dart: <T>[],
flutter: <T>[],
ordered: <(DetermineFlutterOrDart, T)>[],
);
for (final pubspec in pubspecs) {
final flutterOrDart = DetermineFlutterOrDart(
pubspecYaml: pubspec,
pubspecLock: pubspecLock,
findFile: findFile,
);
final project = path.dirname(pubspec);
final relativeDir = path.relative(
project,
from: fs.currentDirectory.path,
);
if (dartOnly ^ flutterOnly) {
if (dartOnly && flutterOrDart.isFlutter) {
logger.detail('Skipping flutter project: $relativeDir');
continue;
} else if (flutterOnly && flutterOrDart.isDart) {
logger.detail('Skipping dart project: $relativeDir');
continue;
}
}
final command = getCommandToRun(flutterOrDart);
commands.ordered.add((flutterOrDart, command));
if (flutterOrDart.isFlutter) {
commands.flutter.add(command);
} else {
commands.dart.add(command);
}
}
return commands;
}