getStringList static method

List<String> getStringList(
  1. String key, [
  2. List<String> defaultValue = const []
])

Get the data as list of String.

Specify the key of the value you want to get for key.

If the value does not exist in the specified key, the value of defaultValue will be returned.

Implementation

static List<String> getStringList(String key,
    [List<String> defaultValue = const []]) {
  if (!isInitialized) {
    debugPrint(
        "It has not been initialized. Please initialize it by executing [initialize()].");
    return const [];
  }
  if (!containsKey(key)) {
    return defaultValue;
  }
  return _preferences?.getStringList(key) ?? defaultValue;
}