findBehavior<T extends Behavior<EntityMixin> > method
T
findBehavior<T extends Behavior<EntityMixin> >()
Returns the first found behavior with the given type, that is attached to this entity.
This will only return a behavior that has a completed lifecycle, aka it is fully mounted. If no behavior is found, it will throw a StateError.
Implementation
T findBehavior<T extends Behavior>() {
final it = findBehaviors<T>().iterator;
if (!it.moveNext()) {
throw StateError('No behavior of type $T found.');
}
return it.current;
}