DeviceDiscovery class
Finds running Flutter apps + booted devices so attach can auto-fill omitted args.
Pure host inspection: ps for VM URIs, xcrun simctl for iOS sims, adb devices for Android.
Constructors
- DeviceDiscovery({String adbPath = 'adb'})
-
const
Properties
Methods
-
androidPackageForPid(
String serial, int pid) → Future< String?> -
The Android package whose process is
pidonserial, or null when adb cannot tell. -
appInfoForDevice(
String udid) → Future< (String?, String?)?> -
(CFBundleIdentifier, display name) of the user app running on iOS
udid, found by itsContainers/Bundle/Application/…appprocess — device-global, NOT correlated to our VM. Fallback only, for when the project dir is unknown; prefer appInfoForProject. -
appInfoForProject(
String projectDir) → Future< (String?, String?)?> -
(CFBundleIdentifier, display name) from the app flutter built for
projectDir. Tied to the exact project behind our VM (projectDirForVm), so it can't grab a different app that also ran on the device. Null when no built product exists (e.g. attached to an app we didn't build here). -
correlate(
Uri vmUri, DevicePlatform platform) → Future< AppDeviceLink?> -
describeRunningApps(
DiscoveryResult scan) → Future< List< RunningApp> > -
Recover the device an app runs on from its VM service URI — when several sims share 127.0.0.1
the port is ambiguous, but the listening process reveals its sim.
Describe every running app in
scan: device (iOS via the flutter_tools process chain, Android viaadb forward) plus bundle identity when the app's Info.plist is reachable. Best-effort per app; never throws. -
foregroundPackage(
String serial) → Future< String?> -
Whether
deviceIdis still booted / connected — the cheap check behinddeviceGone, so a closed simulator is named instead of guessed at. The package in front on Android deviceserial(e.g. the launcher), or null when adb cannot tell. -
goneReasons(
Iterable< ({String id, DevicePlatform platform})> devices) → Future<Map< String, String> > -
Why each of
devicesis gone from the host, keyed by id; oneadb devicesand onesimctl listat most, run together. A device the host could not be asked about, and a physical iPhone, is left out. -
isDevicePresent(
String deviceId, DevicePlatform platform) → Future< bool> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
projectDirForVm(
Uri vmUri) → Future< String?> -
Flutter project root behind a running app: the cwd of the DDS serving
vmUri(its listener, or the DDS fronting that raw VM port) or of itsflutter runparent, when that folder is a Flutter app. -
scan(
) → Future< DiscoveryResult> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
appBundlePathsForDevice(
String output, String udid) → List< String> -
Distinct
…appbundle paths forudidfound inpsoutput. More than one means multiple apps share the sim — the caller treats that as ambiguous. Static + pure so it's unit-testable without a liveps. -
flutterBundlesFirst(
List< String> paths, {required bool isFlutter(String id)}) → List<String> -
The Flutter apps among
pathswhen there are any: a VM service belongs to one, so another app on the simulator (glint's own XCTest runner host, a system helper) must not make the device ambiguous. -
linkFromCommandLine(
String cmd, List< BootedDevice> booted, Future<(String?, String?)?> readBundle(String udid)) → Future<AppDeviceLink?> - Pure: the device link a process command line reveals, if any.