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 typeT.- The instance is automatically removed when the owning widget unmounts.
- External objects (
.valueconstructors) 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
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
owneris the last owner. -
saveSelf(
BuildContext? context, {Object? owner}) → void -
Register this instance in the
CoreContainerunder its runtime type. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited