parseList static method

List<Article> parseList(
  1. dynamic list
)

Parses a list of JSON objects into a list of Article instances. Returns an empty list if list is null, not a list, or empty.

Implementation

static List<Article> parseList(dynamic list) {
  if (list == null || list is! List || list.isEmpty) return [];
  return list.map((e) => Article.fromJson(e)).toList();
}