简体   繁体   English

热重载不更新资产文件

[英]Hot reload not updating asset files

I'm using flutter for almost a year.我使用 flutter 将近一年了。 And one thing that I don't really understand or can't find an answer for it.还有一件事我不太了解或找不到答案。

I started the application.我启动了应用程序。 Then I added some assets to the specified by pubspec.yaml file.然后我在pubspec.yaml文件中添加了一些资产。

Now I know that I need to run pub get .现在我知道我需要运行pub get But when I run hot reload or hot restart there's no update (App don't have new Images).但是当我运行hot reloadhot restart时没有更新(应用程序没有新图像)。 Asset files are allowed to use when I stop the app and start again.当我停止应用程序并start时,允许使用资产文件。

Be sure to let me know if any articles can help me.请务必让我知道是否有任何文章可以帮助我。

Basically the difference is:基本上区别在于:
Hot reload: just reload the UI, it rebuilds the UI(user interface), without losing the state of your app(variables content, etc).热重新加载:只需重新加载 UI,它会重建 UI(用户界面),而不会丢失您的应用程序的 state(变量内容等)。
Hot Restart: loads code changes, and restarts the Flutter app, but basically it uses the precompile files to save time instead reloading the whole app.热重启:加载代码更改,并重启 Flutter 应用程序,但基本上它使用预编译文件来节省时间,而不是重新加载整个应用程序。
So you have to stop the app when you change something in your pubspec or for example in your andriodManifest because this files are updated just when you compile again your app..因此,当您更改 pubspec 或例如在您的 andriodManifest 中的某些内容时,您必须停止该应用程序,因为这些文件仅在您再次编译您的应用程序时更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM