ExposedMixin mixin

Mixin that registers the current instance in the CoreContainer so it can be looked up from anywhere via find().

Use this when you need parent-to-child access, sibling-to-sibling access, or non-widget layers (e.g. Logic) calling into an active model/logic.

class DetailModel extends Model with ExposedMixin {
  void reload() {}
}

Lookup:

find<DetailModel>()?.reload();

Rules

  • find<T>() returns the last-registered instance of type T.
  • The instance is automatically removed when the owning widget unmounts.
  • External objects (.value constructors) are not disposed, but are still removed from the active registry on unmount.
  • For multiple owners sharing the same external instance, the instance remains registered until all owners unmount.
Superclass constraints

Properties

exposed bool
Whether this instance is currently registered in the container.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
topLogic bool
no setter

Methods

dispose() → void
Release resources held by this object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeSelf({Object? owner}) → void
Remove this instance from the container if owner is the last owner.
saveSelf(BuildContext? context, {Object? owner}) → void
Register this instance in the CoreContainer under its runtime type.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited