collapseSameApp function

List<RunningApp> collapseSameApp(
  1. List<RunningApp> apps
)

Drops later entries for the same bundle on the same device: one app can surface under two URIs (its DDS and the raw VM, or a helper process quoting it).

Implementation

List<RunningApp> collapseSameApp(List<RunningApp> apps) {
  final seen = <String>{};
  return [
    for (final a in apps)
      if (a.deviceId == null || a.bundleId == null || seen.add('${a.deviceId}|${a.bundleId}')) a,
  ];
}