canUpdate static method
Whether the newComponent
can be used to update an Element that currently
has the oldComponent
as its configuration.
An element that uses a given component as its configuration can be updated to use another component as its configuration if, and only if, the two components have runtimeType and key properties that are operator==.
If the components have no key (their key is null), then they are considered a match if they have the same type, even if their children are completely different.
Implementation
static bool canUpdate(Component oldComponent, Component newComponent) {
return oldComponent.runtimeType == newComponent.runtimeType && oldComponent.key == newComponent.key;
}