getVisibleNewsInBounds function
- required MapController mapController,
- required List<
NewsMarker> newsMarkers, - required bool showNews,
Gets visible news markers within map bounds.
Implementation
List<NewsMarker> getVisibleNewsInBounds({
required MapController mapController,
required List<NewsMarker> newsMarkers,
required bool showNews,
}) {
if (!showNews || newsMarkers.isEmpty) return [];
final b = mapController.camera.visibleBounds;
return newsMarkers
.where(
(m) =>
m.location.latitude >= b.south &&
m.location.latitude <= b.north &&
m.location.longitude >= b.west &&
m.location.longitude <= b.east,
)
.toList();
}