问题描述
我想在其他屏幕上共享这些变量,除了推送它们之外,共享它们的最佳方法是什么?
解决方法
您可以尝试使用Singletons,将变量存储在Singleton类中并在屏幕上共享它们。
class YourClass {
static YourClass _instance;
YourClass._();
static YourClass get instance => _instance = _instance ?? YourClass._();
// Your instance variables that you want to share can go here
var isVisible = false
}