Is there a way to manage a global store in flutter?
375
You can create a static class having all parameters eg.
class AppConstants {
static String dbName="Documents/APPDBv1.1.db";
static String userid="[USER_ID]";
static String token="[TOKEN]";
static bool authenticated=false;
static String syncDate="01/01/2019 00:00";
static final List<String> myValue= ["A","B","C","D"];
}
the specific parameters can be saved to database/shared preference/local storage and can be retrieved from database/shared preference/local storage and stored in this static class.
Author by
PrasadM96
I am a final year undergraduate at Faculty of Engineering, University of Peradeniya, Sri Lanka. I follow my degree in BSc Computer Engineering. I am very interested in fields like web, mobile development and deep lerning.
Updated on December 17, 2022Comments
-
PrasadM96 over 1 year
In an app we may want to display some pages depend on some conditions like is authenticated or not. So managing a store is better in my view. Is there a way to manage a global store in flutter?