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.


bool setSelection(Object? object, [ String? groupName ]) {
  if (object is Element || object is RenderObject) {
    if (object is Element) {
      if (object == selection.currentElement) {
        return false;
      selection.currentElement = object;
    } else {
      if (object == selection.current) {
        return false;
      selection.current = object! as RenderObject;

    return true;
  return false;