ChangeDetectionStrategy enum
Describes within the change detector which strategy will be used the next time change detection is triggered.
! Changes to this class require updates to view_compiler/constants.dart.
Values
- checkAlways → const ChangeDetectionStrategy
-
The default type of change detection, always checking for changes.
When an asynchronous event (such as user interaction or an RPC) occurs within the app, the root component of the app is checked for changes, and then all children in a depth-first search.
- onPush → const ChangeDetectionStrategy
-
An optimized form of change detection, skipping some checks for changes.
Unlike checkAlways, onPush waits for the following signals to check a component:
- An
@Input()
on the component being changed. - An
@Output()
or event listener (i.e.(click)="..."
) being executed in the template of the component or a descendant. - A call to
<ChangeDetectorRef>.markForCheck()
in the component or a descendant.
Otherwise, change detection is skipped for this component and its descendants. An onPush configured component as a result can afford to be a bit less defensive about caching the result of bindings, for example.
WARNING: It is currently undefined behavior to have a checkAlways configured component as a child (or directive) of a component that is using onPush. We hope to introduce more guidance here in the future.
- An
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
ChangeDetectionStrategy> - A constant List of the values in this enum, in order of their declaration.