handleDragEnter method

void handleDragEnter(
  1. DragSession session
)

Handles when a drag session enters the target boundaries.

Implementation

void handleDragEnter(DragSession session) {
  final dragTarget = widget as DragTarget<T>;
  final data = session.data;
  if (data is T) {
    final castedData = data as T;
    if (dragTarget.onWillAccept == null ||
        dragTarget.onWillAccept!(castedData)) {
      _candidateData.add(castedData);
      markNeedsBuild();
    } else {
      _rejectedData.add(castedData);
    }
  } else {
    _rejectedData.add(data);
  }
}