setSelection method
- @protected
@protected
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]) {
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;
}
if (selectionChangedCallback != null) {
if (SchedulerBinding.instance.schedulerPhase == SchedulerPhase.idle) {
selectionChangedCallback();
} else {
// It isn't safe to trigger the selection change callback if we are in
// the middle of rendering the frame.
SchedulerBinding.instance.scheduleTask(
selectionChangedCallback,
Priority.touch,
);
}
}
return true;
}
return false;
}