我正在做一个Flutter 项目,想知道如何保存变量的新值.例如,如果我说bool X = false;
,并在‘on Tap(){}’函数中说X=TRUE;现在新值为TRUE.我的问题是,当我重新启动应用程序时,它返回到旧的值,这是假的.
那么,即使我重启了我的应用程序,我如何保存新的价值呢?
bool W1_D1_workout1 = false;
Container(
height: 40,width: 40,
color: Colors.black87,
child: MaterialButton(onPressed: ()
{
W1_D1_workout1 = true;
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)
=>getCongratsScreen()));
},child: Text('Done',style: TextStyle(
fontSize: 20,fontWeight: FontWeight.w500,color: Colors.white
),),)),