flutter混合開發后,在Xcode中運行工程,由於flutter項目沒有運行起來,是沒辦法熱更新的,但是這種場景是可以解決的
- Flutter和原生(這里只說iOS 參考https://www.cnblogs.com/qqcc1388/p/12693991.html)混合開發配置
- Xcode中運行App
- Flutter工程中(我這里是VSCode中)執行命令行
chenhaodeMac:flutter_project chenhao$ flutter attach
Syncing files to device iPhone 11 Pro Max...
6,854ms (!)
🔥 To hot reload changes while running, press "r". To hot restart (and rebuild state), press
"R".
An Observatory debugger and profiler on iPhone 11 Pro Max is available at:
http://127.0.0.1:64758/Ohwd6eZv1eY=/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
執行完flutter attack你會發現,命令行熟悉的頁面出現了,此時試試看,在VSCode中做Flutter頁面的修改,會直接修改模擬器中的頁面
注意 需要先讓native代碼運行起來,在執行flutter attach