Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
819 views
in Technique[技术] by (71.8m points)

dart - How to clear Flutter's Build cache?

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: 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...