I am simply saving the string value in FlutterSecureStorage and getting it on other page issue is its printing the value on other page but showing error
First page where I save the string
if(data['access_token'].length > 2) {
final storage = new FlutterSecureStorage();
await storage.write(key: 'token', value: data['access_token']);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MyStatefulWidget()),
);
}
Second page where I am getting it
class _EventsState extends State<Events> {
@override
initState() async {
// TODO: implement initState
final storage = new FlutterSecureStorage();
String value = await storage.read(key: 'token');
print(value);
super.initState();
}
}
Error is
_EventsState.initState() returned a Future.
Also attaching whole error