MemoryRecallResult.fromJson constructor

MemoryRecallResult.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory MemoryRecallResult.fromJson(Map<String, dynamic> json) {
  final rawItems = json["items"];
  if (rawItems != null && rawItems is! List) {
    throw _memoryUnexpectedResponseError("recall");
  }

  return MemoryRecallResult(
    name: _memoryRequiredString(json["name"], "recall"),
    query: _memoryRequiredString(json["query"], "recall"),
    items: (rawItems as List? ?? const [])
        .map((item) => MemoryRecallItem.fromJson(_memoryJsonMap(item, "recall")))
        .toList(growable: false),
  );
}