setSelection method

  1. @protected
bool setSelection(
  1. Object? object, [
  2. String? groupName
])

Set the WidgetInspector selection to the specified object if it is a valid object to set as the inspector selection.

Returns true if the selection was changed.

The groupName parameter is not needed but is specified to regularize the API surface of methods called from the Flutter IntelliJ Plugin.

Implementation

@protected
bool setSelection(Object? object, [ String? groupName ]) {
  switch (object) {
    case Element() when object != selection.currentElement:
      selection.currentElement = object;
      _sendInspectEvent(selection.currentElement);
      return true;
    case RenderObject() when object != selection.current:
      selection.current = object;
      _sendInspectEvent(selection.current);
      return true;
  }
  return false;
}