I'm trying to store some data using FlutterSecureStorage. The data is stored and retrieved correctly every time I open the screen in the app.
However, if I restart the app, the data is lost. What am I doing wrong?
This is how I store the data:
usuario = user.textField.text;
clave = pass.textField.text;
await almacenDatos.write(key: "usuario", value: usuario);
await almacenDatos.write(key: "clave", value: clave);
This is how I retrieve the data.
void credenciales() async {
String? usuario_aux = await almacenDatos.read(key: "usuario");
String? clave_aux = await almacenDatos.read(key: "clave");
if(usuario_aux != null){
usuario = usuario_aux;
}
if(clave_aux != null){
clave = clave_aux;
}
}