removeDispatcher static method

void removeDispatcher(
  1. Component component, {
  2. required bool hasDrag,
  3. required bool hasScale,
})
override

Decrements the reference counts for component's event types and disables the corresponding recognizer flags when the count reaches zero.

Implementation

static void removeDispatcher(
  Component component, {
  required bool hasDrag,
  required bool hasScale,
}) {
  final game = component.findRootGame();
  if (game == null) {
    return;
  }
  final dispatcher =
      game.findByKey(const MultiDragScaleDispatcherKey())
          as MultiDragScaleDispatcher?;
  if (dispatcher == null) {
    return;
  }
  if (hasDrag) {
    dispatcher._disableDrag();
  }
  if (hasScale) {
    dispatcher._disableScale();
  }
}