GetStringList function

List<String>? GetStringList(
  1. String key
)

Implementation

List<String>? GetStringList(String key) {
  final value = GetCookie(key);
  if (value == null) return null;

  try {
    final decoded = jsonDecode(value);
    if (decoded is List && decoded.every((item) => item is String)) {
      return List<String>.from(decoded);
    }
  } on FormatException {
    // Values written by other setters may not be JSON lists.
  }
  return null;
}