[英]How access to value of a variable in flutter package from other widget?
I wrote a package
for Flutter
and added it to the main.dart and it works well but How can I access the value of one of the variables in the package? I wrote a
package
for Flutter
and added it to the main.dart and it works well but How can I access the value of one of the variables in the package? or how return a variables from it?或者如何从中返回变量? For example, in the
slider
widget, we have access to the value of the slider with on change.例如,在
slider
小部件中,我们可以通过 on change 访问 slider 的值。
You want to learn how to manage state in flutter.您想了解如何管理 flutter 中的 state。
There are couple of good state management tools:有几个很好的 state 管理工具:
provider seems to be the easiest one. provider似乎是最简单的一个。
Here is a nice tutorial on provider:这是关于提供者的一个很好的教程:
https://blog.codemagic.io/flutter-tutorial-app-arhitecture-beginners/ https://blog.codemagic.io/flutter-tutorial-app-arhitecture-beginners/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.