Commit ffe5851e authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Do not throw if a hot reload is attempted when all Flutter instances on the...

Do not throw if a hot reload is attempted when all Flutter instances on the device have been stopped (#11504)

This can happen if an Android host app has been paused but its process is still running
parent 8ee902c0
......@@ -467,16 +467,19 @@ class HotRunner extends ResidentRunner {
final String entryPath = fs.path.relative(mainPath, from: projectRootPath);
if (benchmarkMode)
vmReloadTimer.start();
Map<String, dynamic> reloadReport;
final List<Future<Map<String, dynamic>>> reloadReports = <Future<Map<String, dynamic>>>[];
final List<Future<Map<String, dynamic>>> reloadReportFutures = <Future<Map<String, dynamic>>>[];
for (FlutterDevice device in flutterDevices) {
final List<Future<Map<String, dynamic>>> reports = device.reloadSources(
entryPath,
pause: pause
);
reloadReports.addAll(reports);
reloadReportFutures.addAll(reports);
}
reloadReport = (await Future.wait(reloadReports)).first;
if (reloadReportFutures.isEmpty) {
printError('Unable to hot reload. No instance of Flutter is currently running.');
return new OperationResult(1, 'No instances running');
}
final Map<String, dynamic> reloadReport = (await Future.wait(reloadReportFutures)).first;
if (!validateReloadReport(reloadReport)) {
// Reload failed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment