mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] Refresh VM state before executing hot reload (#53960)
This commit is contained in:
parent
cccfe96e72
commit
c663cd55a7
@ -825,6 +825,13 @@ abstract class ResidentRunner {
|
||||
await Future.wait(futures);
|
||||
}
|
||||
|
||||
Future<void> refreshVM() async {
|
||||
final List<Future<void>> futures = <Future<void>>[
|
||||
for (final FlutterDevice device in flutterDevices) device.getVMs(),
|
||||
];
|
||||
await Future.wait(futures);
|
||||
}
|
||||
|
||||
Future<void> debugDumpApp() async {
|
||||
await refreshViews();
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
|
@ -798,6 +798,7 @@ class HotRunner extends ResidentRunner {
|
||||
|
||||
if (!_isPaused()) {
|
||||
globals.printTrace('Refreshing active FlutterViews before reloading.');
|
||||
await refreshVM();
|
||||
await refreshViews();
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,7 @@ void main() {
|
||||
});
|
||||
when(mockFlutterDevice.vmService).thenReturn(mockVMService);
|
||||
when(mockFlutterDevice.refreshViews()).thenAnswer((Invocation invocation) async { });
|
||||
when(mockFlutterDevice.getVMs()).thenAnswer((Invocation invocation) async { });
|
||||
when(mockFlutterDevice.reloadSources(any, pause: anyNamed('pause'))).thenReturn(<Future<Map<String, dynamic>>>[
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{
|
||||
'type': 'ReloadReport',
|
||||
|
Loading…
Reference in New Issue
Block a user