getStringList method

List<String>? getStringList(
  1. String key

Reads a set of string values from persistent storage, throwing an exception if it's not a string set.


List<String>? getStringList(String key) {
  List<dynamic>? list = _preferenceCache[key] as List<dynamic>?;
  if (list != null && list is! List<String>) {
    list = list.cast<String>().toList();
    _preferenceCache[key] = list;
  // Make a copy of the list so that later mutations won't propagate
  return list?.toList() as List<String>?;