0 purchases
d session
Easy way to access Shared Preference, or we can call like session. For more customization, you can use shared_preferences package.
Features #
User
Token
Custom
1. User #
final user = {
'id': 'aha276avsUHUa',
'email': '[email protected]',
'username': 'indre',
};
DSession.setUser(user);
DSession.getUser().then((value) {
debugPrint(value.toString());
if (value != null) {
debugPrint(value['email']);
}
});
DSession.removeUser();
copied to clipboard
2. Token #
final data = {
'token': 'askuaysuabs',
'expire': '2023-10-10 01:01:01',
};
DSession.setToken(data);
DSession.getToken().then((value) {
debugPrint(value.toString());
});
DSession.removeToken();
copied to clipboard
3. Custom #
For custom, you must set the key. The keyword must be other than:
d_session_user
d_session_token
DSession.setCustom('isDark', true);
final data = await DSession.getCustom('isDark');
debugPrint(data.toString());
bool isDark = data ?? false;
if(isDark){
debugPrint('Dark theme activated');
}
DSession.removeCustom('isDark');
copied to clipboard
Additional information #
...
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.