remove method
Remove from filtering only those elements that are contained within the range of adjacent GeoHashes of value
.
value
の隣り合うGeoHashの範囲内に含む要素のみをフィルタリングから削除します。
Implementation
TQuery remove(ModelGeoValue? value) {
if (value == null) {
return _toQuery(_modelQuery);
}
final sourceNeighbors = _modelQuery.filters
.firstWhereOrNull(
(element) => element.key == key,
)
?.value as List<String>?;
sourceNeighbors?.remove(value.value.geoHash);
for (final hash in value.value.neighbors) {
sourceNeighbors?.remove(hash);
}
return _toQuery(
_modelQuery.geo(
key,
sourceNeighbors?.distinct().sortTo((a, b) => a.compareTo(b)) ?? [],
),
);
}