@@ -41,13 +41,59 @@ class SharedPreferenceAppGroup {
4141 await _setValue ('String' , key, value);
4242 }
4343
44+ /// Saves a string list [value] to persistent storage under the specified app group.
45+ ///
46+ /// If [value] is null, this is equivalent to calling [remove()] on the [key] .
47+ static Future <void > setStringList (String key, List <String >? value) async {
48+ await _setValue ('StringArray' , key, value);
49+ }
50+
4451 /// Reads a value of any type from persistent storage under the specified app group.
4552 ///
4653 /// If the persistent storage does not contains [key] , then [null] will be returned
4754 static Future <dynamic > get (String key) async {
4855 return await _channel.invokeMethod ('get' , {'key' : key});
4956 }
5057
58+ /// Reads a boolean value from persistent storage under the specified app group.
59+ ///
60+ /// If the persistent storage does not contains [key] , then [null] will be returned
61+ static Future <bool ?> getBool (String key) async {
62+ return await _channel.invokeMethod ('getBool' , {'key' : key});
63+ }
64+
65+ /// Reads a integer value from persistent storage under the specified app group.
66+ ///
67+ /// If the persistent storage does not contains [key] , then [null] will be returned
68+ static Future <int ?> getInt (String key) async {
69+ return await _channel.invokeMethod ('getInt' , {'key' : key});
70+ }
71+
72+ /// Reads a double value from persistent storage under the specified app group.
73+ ///
74+ /// If the persistent storage does not contains [key] , then [null] will be returned
75+ static Future <double ?> getDouble (String key) async {
76+ return await _channel.invokeMethod ('getDouble' , {'key' : key});
77+ }
78+
79+ /// Reads a string value from persistent storage under the specified app group.
80+ ///
81+ /// If the persistent storage does not contains [key] , then [null] will be returned
82+ static Future <String ?> getString (String key) async {
83+ return await _channel.invokeMethod ('getString' , {'key' : key});
84+ }
85+
86+ /// Reads a string array value from persistent storage under the specified app group.
87+ ///
88+ /// If the persistent storage does not contains [key] , then [null] will be returned
89+ static Future <List <String >?> getStringList (String key) async {
90+ final List ? receivedArray = await _channel.invokeMethod ('getStringArray' , {'key' : key});
91+ if (receivedArray != null ) {
92+ return receivedArray.cast <String >();
93+ }
94+ return null ;
95+ }
96+
5197 /// Reads all key-value pairs from persistent storage under the specified app group.
5298 static Future <Map <String , dynamic >> getAll () async {
5399 Map <dynamic , dynamic > allPrefs = await _channel.invokeMethod ('getAll' );
0 commit comments