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.

Inheritance
Available extensions

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.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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.