Posts

How to read value in the createState method of StatefulWidget

Image
up vote 1 down vote favorite Hello I want to read the value from the SharedPreferences inside the createState of the StatefulWidget . I tried to add async after the method but it doesn't work. What is the correct way to do ? class LoginScreen extends StatefulWidget { @override _LoginScreenState createState() { // check if user is logged. If logged then send user to dashboard else keep it here return new _LoginScreenState(); } } android ios flutter sharedpreferences share | improve this question asked Nov 22 at 16:52 N Sharma 6,972 43 141 289 ...