getStringList method
- String key
Retrieves a list of strings from SharedPreferences.
Returns the default value if the key does not exist.
key: The key for the list of strings to be retrieved.
Implementation
Future<List<String>> getStringList(String key) async {
await ensureSharedPrefIsInitialized();
if (stringListKeys.containsKey(key)) {
return prefs.getStringList(key) ?? stringListKeys[key]!;
} else {
throw Exception("Key '$key' is not implemented as string list.");
}
}