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

Method constructor

src/shared/vscode/device_manager.ts:35–67  ·  view source on GitHub ↗
(
		private readonly logger: Logger,
		private daemon: IFlutterDaemon,
		private readonly config: { flutterCustomEmulators: CustomEmulatorDefinition[], flutterRememberSelectedDevice: boolean, flutterSelectDeviceWhenConnected: boolean, flutterShowEmulators: "local" | "always" | "never", projectSearchDepth: number },
		private readonly workspaceContext: WorkspaceContext,
		private readonly extContext: Context,
		runIfNoDevices?: () => void,
		readonly daemonPortOverride?: number
	)

Source from the content-addressed store, hash-verified

33 public readonly onDeviceChanged = this.onDeviceChangedEmitter.event;
34
35 constructor(
36 private readonly logger: Logger,
37 private daemon: IFlutterDaemon,
38 private readonly config: { flutterCustomEmulators: CustomEmulatorDefinition[], flutterRememberSelectedDevice: boolean, flutterSelectDeviceWhenConnected: boolean, flutterShowEmulators: "local" | "always" | "never", projectSearchDepth: number },
39 private readonly workspaceContext: WorkspaceContext,
40 private readonly extContext: Context,
41 runIfNoDevices?: () => void,
42 readonly daemonPortOverride?: number
43 ) {
44 this.statusBarItem = vs.window.createStatusBarItem("dartStatusFlutterDevice", vs.StatusBarAlignment.Right, 1);
45 this.statusBarItem.name = "Flutter Device";
46 this.statusBarItem.tooltip = "Flutter";
47 this.statusBarItem.command = "flutter.selectDevice";
48 this.statusBarItem.show();
49 void this.updateStatusBar();
50
51 // Force a request for emulators to stash their names, so we can display
52 // the better name if the automatically-selected device happens to be an
53 // emulator.
54 this.getEmulators().then(() => this.updateStatusBar()).catch((e) => this.logger.error(e));
55
56 this.subscriptions.push(this.statusBarItem);
57
58 daemon.registerForDeviceAdded(this.deviceAdded.bind(this));
59 daemon.registerForDeviceRemoved(this.deviceRemoved.bind(this));
60 if (runIfNoDevices) {
61 setTimeout(() => {
62 if (this.devices.length === 0) {
63 runIfNoDevices();
64 }
65 }, 10000).unref();
66 }
67 }
68
69 public dispose() {
70 disposeAll(this.subscriptions);

Callers

nothing calls this directly

Calls 6

updateStatusBarMethod · 0.95
getEmulatorsMethod · 0.95
errorMethod · 0.65
showMethod · 0.45

Tested by

no test coverage detected