如何清除Flutter的构建缓存? [英] How to clear Flutter's Build cache?
问题描述
flutter的构建似乎有问题。
我总是需要执行 RUN > Flutter完全重启
否则,该应用程序将加载一个脚手架主体,该主体是我两周前首次开始对其进行编码时所拥有的代码。
我猜是flutter缓存了旧代码,从不费心用新代码替换它,但我不确定它是如何实现热加载的。无论如何,当我们已经执行了完全重建时,我认为没有必要加载旧的缓存。
您可以运行 flutter clean
。
但这很可能是您的IDE或类似问题,因为抖动运行会产生全新的APK。
尝试使用命令行 flutter run
运行应用,然后按 r
或 R
分别用于热重装和完全重装。
There seems to be a problem with flutter's build.
I always need to perform RUN > Flutter Full Restart everytime I run the app to an emulator or device.
Otherwise, the app loads a scaffold body which my code had from 2 weeks ago when I first started coding it.
Here's the current source on pastebin
children: <Widget>[
new Opacity(
opacity: loader_visible ? 1.0 : 0.0,
child:
new Container(
padding: const EdgeInsets.all(32.0),
child: new CircularProgressIndicator()
)
),
while here is the resulting render tree:
I'm guessing flutter has cached the old code and never bothered replacing it with the new one, but I am not sure how it's Hot Reload was implemented. Anyways, I don't think that it is necessary to load the old cache when we have already performed a full rebuild.
You can run flutter clean
.
But that's most likely a problem with your IDE or similar, as flutter run creates a brand new apk. And hot reload push only modifications.
Try running your app using the command line flutter run
and then press r
or R
for respectively hot-reload and full-reload.
这篇关于如何清除Flutter的构建缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!