dragEvents method

Cancelable dragEvents({
  1. dynamic onBegin(
    1. PointAnnotation
    )?,
  2. dynamic onChanged(
    1. PointAnnotation
    )?,
  3. dynamic onEnd(
    1. PointAnnotation
    )?,
})

Registers drag event callbacks for the annotations managed by this manager.

  • onBegin: Triggered when a drag gesture begins on an annotation.
  • onChanged: Triggered continuously as the annotation is being dragged.
  • onEnd: Triggered when the drag gesture ends.

This method returns a Cancelable object that can be used to cancel the drag event listener when it's no longer needed.

Implementation

Cancelable dragEvents({
  Function(PointAnnotation)? onBegin,
  Function(PointAnnotation)? onChanged,
  Function(PointAnnotation)? onEnd,
}) => impl.dragInteractionStream.listen((data) {
  switch (data.gestureState) {
    case GestureState.started when onBegin != null:
      onBegin(data.annotation);
    case GestureState.changed when onChanged != null:
      onChanged(data.annotation);
    case GestureState.ended when onEnd != null:
      onEnd(data.annotation);
    default:
      break;
  }
}).asCancelable();