canUpdate static method

bool canUpdate(
  1. Widget oldWidget,
  2. Widget newWidget
)

Whether the framework can update oldWidget's element to display newWidget.

Two widgets can be updated when they have the same runtimeType and key (both null counts as matching).

Implementation

static bool canUpdate(Widget oldWidget, Widget newWidget) {
  return oldWidget.runtimeType == newWidget.runtimeType &&
      oldWidget.key == newWidget.key;
}