我有这些变量,我想与另一个屏幕共享,除了推送它们之外,共享它们的最佳方式是什么?
您可以尝试使用singleton,将变量存储在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
}