shipsWithApp method

bool shipsWithApp(
  1. String name
)

Whether a release build can reach name: it is a dependency (not only a dev dependency) of a root, directly or through others.

Implementation

bool shipsWithApp(String name) {
  final seen = <String>{};
  final queue = [for (final r in roots) ...?nodes[r]?.dependencies];
  while (queue.isNotEmpty) {
    final next = queue.removeLast();
    if (!seen.add(next)) continue;
    if (next == name) return true;
    queue.addAll(nodes[next]?.dependencies ?? const []);
  }
  return false;
}