@@ -215,7 +215,11 @@ known, it can be explicitly provided to attach via the command-line, e.g.
215215 Future <FlutterCommandResult > runCommand () async {
216216 await _validateArguments ();
217217
218- final Device device = await (findTargetDevice () as FutureOr <Device >);
218+ final Device ? device = await findTargetDevice ();
219+
220+ if (device == null ) {
221+ throwToolExit ('Did not find any valid target devices.' );
222+ }
219223
220224 final Artifacts ? overrideArtifacts = device.artifactOverrides ?? globals.artifacts;
221225 await context.run <void >(
@@ -272,7 +276,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
272276 } else if ((device is IOSDevice ) || (device is IOSSimulator ) || (device is MacOSDesignedForIPadDevice )) {
273277 final Uri ? uriFromMdns =
274278 await MDnsObservatoryDiscovery .instance! .getObservatoryUri (
275- appId! ,
279+ appId,
276280 device,
277281 usesIpv6: usesIpv6,
278282 deviceVmservicePort: deviceVmservicePort,
@@ -317,12 +321,12 @@ known, it can be explicitly provided to attach via the command-line, e.g.
317321 try {
318322 int ? result;
319323 if (daemon != null ) {
320- final ResidentRunner runner = await ( createResidentRunner (
324+ final ResidentRunner runner = await createResidentRunner (
321325 observatoryUris: observatoryUri,
322326 device: device,
323327 flutterProject: flutterProject,
324328 usesIpv6: usesIpv6,
325- ) as FutureOr < ResidentRunner >) ;
329+ );
326330 late AppInstance app;
327331 try {
328332 app = await daemon.appDomain.launch (
@@ -351,12 +355,12 @@ known, it can be explicitly provided to attach via the command-line, e.g.
351355 return ;
352356 }
353357 while (true ) {
354- final ResidentRunner runner = await ( createResidentRunner (
358+ final ResidentRunner runner = await createResidentRunner (
355359 observatoryUris: observatoryUri,
356360 device: device,
357361 flutterProject: flutterProject,
358362 usesIpv6: usesIpv6,
359- ) as FutureOr < ResidentRunner >) ;
363+ );
360364 final Completer <void > onAppStart = Completer <void >.sync ();
361365 TerminalHandler ? terminalHandler;
362366 unawaited (onAppStart.future.whenComplete (() {
@@ -400,7 +404,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
400404 }
401405 }
402406
403- Future <ResidentRunner ? > createResidentRunner ({
407+ Future <ResidentRunner > createResidentRunner ({
404408 required Stream <Uri > observatoryUris,
405409 required Device device,
406410 required FlutterProject flutterProject,
@@ -452,7 +456,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
452456}
453457
454458class HotRunnerFactory {
455- HotRunner ? build (
459+ HotRunner build (
456460 List <FlutterDevice > devices, {
457461 required String target,
458462 required DebuggingOptions debuggingOptions,
0 commit comments