diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 7c559abe8e..1b10061d86 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -554,7 +554,11 @@ class HotRunner extends ResidentRunner { .catchError((dynamic error, StackTrace stackTrace) { // Do nothing on a SentinelException since it means the isolate // has already been killed. - }, test: (dynamic error) => error is vm_service.SentinelException)); + // Error code 105 indicates the isolate is not yet runnable, and might + // be triggered if the tool is attempting to kill the asset parsing + // isolate before it has finished starting up. + }, test: (dynamic error) => error is vm_service.SentinelException + || (error is vm_service.RPCError && error.code == 105))); } } await Future.wait(operations); @@ -568,7 +572,6 @@ class HotRunner extends ResidentRunner { // Send timing analytics. globals.flutterUsage.sendTiming('hot', 'restart', restartTimer.elapsed); - // In benchmark mode, make sure all stream notifications have finished. if (benchmarkMode) { final List> isolateNotifications = >[]; for (final FlutterDevice device in flutterDevices) { @@ -584,7 +587,17 @@ class HotRunner extends ResidentRunner { ); } await Future.wait(isolateNotifications); + final List> futures = >[]; + for (final FlutterDevice device in flutterDevices) { + final List views = await device.vmService.getFlutterViews(); + for (final FlutterView view in views) { + futures.add(device.vmService + .flushUIThreadTasks(uiIsolateId: view.uiIsolate.id)); + } + } + await Future.wait(futures); } + // Toggle the main dill name after successfully uploading. _swap =! _swap;