flutter_module 的 Terminal 中打印如下信息 , 说明混合开发中 Flutter 的 热重启 / 热加载 启用成功 ;
Microsoft Windows [版本 10.0.19041.1165] (c) Microsoft Corporation。保留所有权利。 Y:\002_WorkSpace\001_AS\flutter_hybrid\flutter_module>flutter attach Waiting for a connection from Flutter on Pixel 2... Activating Dart DevTools... | Flutter run key commands. r Hot reload. R Hot restart. h Repeat this help message. d Detach (terminate "flutter run" but leave application running). c Clear the screen q Quit (terminate the application on the device). Running with sound null safety An Observatory debugger and profiler on Pixel 2 is available at: http://127.0.0.1:58580/GY8QBzNP2T4=/ 18.5s The Flutter DevTools debugger and profiler on Pixel 2 is available at: http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A58580%2FGY8QBzNP2T4%3D%2F
二、混合开发中 Flutter 的 热重启 / 热加载 命令测试
Flutter 运行按键命令 :
r Hot reload. // 热加载
R Hot restart. // 热重启
h Repeat this help message. // 帮助信息
d Detach (terminate “flutter run” but leave application running).// 取消热修复
c Clear the screen // 清空屏幕
q Quit (terminate the application on the device). // 退出
修改 Flutter 代码后 , 在 Android Studio 的 Terminal 中, 按下 r 键 , 即可进行热更新 ;
Performing hot reload... Reloaded 1 of 553 libraries in 791ms.
标题后面跟着一个热加载后缀 ;
三、指定混合应用连接的设备
如果当前连接了多个设备 , 使用
flutter attach -d 'Pixel 2'
指定连接 " Pixel 2 " 设备 ;
其中 " Pixel 2 " 是设备名称 ;
、