reloadChangedFile method
Implementation
Future<HotReloadResult> reloadChangedFile(String changedFile) async {
if (path.extension(changedFile).toLowerCase() != '.dart') {
return HotReloadResult.failure(changedFile, 'Not a Dart source file.');
}
final isolateId = await _gateway.primaryIsolateId();
if (isolateId == null) {
return HotReloadResult.failure(changedFile, 'No runnable isolate.');
}
final success = await _gateway.reloadSources(isolateId, force: false);
if (!success) {
return HotReloadResult.failure(
changedFile,
'The VM rejected the reload.',
);
}
return HotReloadResult.success(changedFile);
}