setStringList method

Future<void> setStringList(
  1. String key,
  2. List<String> value
)

Stores a list of strings in SharedPreferences.

  • key: The key for the list of strings to be stored.
  • value: The list of strings to store.

Implementation

Future<void> setStringList(String key, List<String> value) async {
  await ensureSharedPrefIsInitialized();
  if (stringListKeys.containsKey(key)) {
    await prefs.setStringList(key, value);
  } else {
    throw Exception("Key '$key' is not implemented as string list.");
  }
}