setRaw method

void setRaw(
  1. Map? rawResponse
)

Method to set the raw response form Elasticsearch

Implementation

void setRaw(Map? rawResponse) {
  // set response
  if (rawResponse != null) {
    this.raw = rawResponse;
    if (this.raw!['hits'] != null && this.raw!['hits']['hits'] is List) {
      final mapped = (this.raw!['hits']['hits'] as List)
          .map((model) => Map<String, dynamic>.from(model));
      data = mapped.toList();
      this.setData(data);
    }
  }
}