fromJson<T> static method
Creates from JSON with a mapper function
Implementation
static QueryResult<T> fromJson<T>(
Map<String, dynamic> json,
T Function(Map<String, dynamic>) mapper,
) {
final docs = json['documents'] ?? json['data'] ?? json['results'] ?? <dynamic>[];
return QueryResult<T>(
data: (docs as List).map((e) => mapper(e as Map<String, dynamic>)).toList(),
total: json['total'] as int?,
limit: json['limit'] as int?,
skip: json['skip'] as int?,
hasMore: json['hasMore'] as bool? ?? false,
);
}