How to check if an item is in multiple Lists Flutter

Viewed 86

I have a Flutter method that places Map Markers

When one is pressed it pops up with a metadata box

Depending on which type of marker is pressed I will trigger a different ShowDialog

I have a Gesture Handler that listens for taps and then reacts.

Currently, upon tap it then calls _pickMapMarker(touchPoint); which allows the metadata to show

I need a _pickMapMarker2 to be an option depending on the type of marker pressed

All markers are added to a list, List<MapMarker> _x when placed, there is list _mapMarkertype1, _mapMarkertype2

I guess I will need an if or for statement but I cannot work it out dependant on the List<MapMarker> the marker belongs to

Currently

 void _setTapGestureHandler() {
    _hereMapController.gestures.tapListener = TapListener((Point2D touchPoint) {
     
      _pickMapMarker(touchPoint);
     });
  }

I need something like (It is of course not functional, just to explain what I need)

  void _setTapGestureHandler() {
    _hereMapController.gestures.tapListener = TapListener((Point2D touchPoint) {
     
      if (MapMarker == _mapMarkerList1) {
      _pickMapMarker(touchPoint);
      }
      if (MapMarker == _mapMarkerList2) {
      _pickMapMarker2(touchPoint);
      }

     });
  }
0 Answers
Related