MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / deviceRemoved

Method deviceRemoved

src/shared/vscode/device_manager.ts:137–156  ·  view source on GitHub ↗
(dev: f.Device)

Source from the content-addressed store, hash-verified

135 }
136
137 public async deviceRemoved(dev: f.Device) {
138 this.devices = this.devices.filter((d) => d.id !== dev.id);
139 if (this.currentDevice?.id === dev.id) {
140 let nextDevice: f.Device | undefined;
141
142 // Try to select the next-best device
143 if (this.devices.length) {
144 const supportedPlatforms = await this.getSupportedPlatformsForWorkspace();
145 const supportedDevices = this.devices.filter((d) => this.isSupported(supportedPlatforms, d));
146 if (supportedDevices?.length)
147 nextDevice = supportedDevices[0];
148 }
149
150 this.setCurrentDevice(nextDevice);
151 }
152
153 void this.updateStatusBar();
154 this.onDeviceRemovedEmitter.fire(dev.id);
155 this.onDevicesChangedEmitter.fire();
156 }
157
158 public async showDevicePicker(supportedTypes: f.PlatformType[] | undefined, projectRoot: string | undefined): Promise<f.Device | undefined> {
159 // If we weren't passed any supported types, we should try to get them for

Callers

nothing calls this directly

Calls 5

isSupportedMethod · 0.95
setCurrentDeviceMethod · 0.95
updateStatusBarMethod · 0.95
fireMethod · 0.45

Tested by

no test coverage detected