Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以添加get_storage进行数据持久化管理吗? #2

Open
sgssxf opened this issue Jul 24, 2024 · 1 comment
Open

可以添加get_storage进行数据持久化管理吗? #2

sgssxf opened this issue Jul 24, 2024 · 1 comment

Comments

@sgssxf
Copy link

sgssxf commented Jul 24, 2024

如题,是否可以在基类控制器中添加数据侦听,使得某些需要持久化的数据简单的进行持久化呢?

@Kxmrg
Copy link
Owner

Kxmrg commented Jul 25, 2024

/// SharedPreferences:

/// Add a value in SharedPref based on their type - Must be a String, int, bool, double, Map<String, dynamic> or StringList
Future setValue(String key, dynamic value, {bool print = true})

/// Returns List of Keys that matches with given Key
List getMatchingSharedPrefKeys(String key)

/// Returns a StringList if exists in SharedPref
List? getStringListAsync(String key)

/// Returns a Bool if exists in SharedPref
bool getBoolAsync(String key, {bool defaultValue = false})

/// Returns a Double if exists in SharedPref
double getDoubleAsync(String key, {double defaultValue = 0.0})

/// Returns a Int if exists in SharedPref
int getIntAsync(String key, {int defaultValue = 0})

/// Returns a String if exists in SharedPref
String getStringAsync(String key, {String defaultValue = ''})

/// Returns a JSON if exists in SharedPref
Map<String, dynamic> getJSONAsync(String key,{Map<String, dynamic>? defaultValue})

/// remove key from SharedPref
Future removeKey(String key)

/// clear SharedPref
Future clearSharedPref()

@Kxmrg Kxmrg closed this as completed Jul 31, 2024
@Kxmrg Kxmrg reopened this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants