getStringList method

  1. @override
Future<List<String>?> getStringList(
  1. String key
)
override

Retrieves a list of strings by its key.

This method fetches a list of strings previously stored using setStringList. If no value exists for the given key, or the stored value is not a list of strings, this method returns null.

Parameters:

  • key - The unique identifier of the string list to retrieve.

Returns a Future that completes with the stored list of strings if found, or null if the key doesn't exist or the value is not a list of strings.

Throws:

Implementation

@override
Future<List<String>?> getStringList(String key) async {
  final value = _data[key];
  if (value == null) return null;
  if (value is! List) return null;
  return List<String>.from(value);
}