readItemMaps function

List<CrossmintJsonMap> readItemMaps(
  1. Object? body
)

Implementation

List<CrossmintJsonMap> readItemMaps(Object? body) {
  if (body is List) {
    return body.whereType<Map<String, Object?>>().toList(growable: false);
  }

  if (body is Map<String, Object?>) {
    final Object? items =
        body['data'] ??
        body['items'] ??
        body['results'] ??
        body['listings'] ??
        body['signatures'] ??
        body['transactions'] ??
        body['nfts'];
    if (items is List) {
      return items.whereType<Map<String, Object?>>().toList(growable: false);
    }
  }

  return const <CrossmintJsonMap>[];
}