extractList static method

List<Object?>? extractList(
  1. String text
)

Extracts a JSON array, or null. A single object is wrapped into a list, mirroring extractMap's tolerance in the other direction.

Implementation

static List<Object?>? extractList(String text) {
  final value = extract(text);
  if (value is List) return value;
  if (value is Map) return [value];
  return null;
}