canUpdate static method
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;
}