RefenaScope class
A wrapper widget around RefenaContainer.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- RefenaScope
- Implemented types
- Available extensions
Constructors
-
RefenaScope.new({Key? key, PlatformHint? platformHint, List<
ProviderOverride< overrides = const [], List<BaseNotifier, dynamic> >BaseProvider< initialProviders = const [], NotifyStrategy defaultNotifyStrategy = NotifyStrategy.identity, List<BaseNotifier, dynamic> >RefenaObserver> observers = const [], bool defaultRef = true, required Widget child}) - Creates a RefenaScope. It will create an implicit RefenaContainer that will be disposed when the RefenaScope is disposed.
- RefenaScope.withContainer({Key? key, required RefenaContainer container, PlatformHint? platformHint, bool ownsContainer = true, bool defaultRef = true, required Widget child})
-
Creates a RefenaScope that uses an existing RefenaContainer.
By default, the RefenaScope will dispose the RefenaContainer
when the RefenaScope itself is disposed.
To prevent this, set
ownsContainer
to false.factory
Properties
- child → Widget
-
The child widget
final
- container → RefenaContainer
-
Returns the backing container.
The container exposes more advanced methods for edge cases.
no setteroverride
- debugLabel → String
-
A label to be used in debug messages and
by the RefenaTracingPage.
no setteroverride
- debugOwnerLabel → String
-
Returns the owner of this Ref.
Usually, this is a notifier or a widget.
Used by Ref.redux to log the origin of the action.
no setteroverride
- defaultNotifyStrategy → NotifyStrategy
-
The default notify strategy
no setteroverride
- disposed → bool
-
Whether the container has been disposed.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- implicitContainer → bool
-
Whether this RefenaScope created its own RefenaContainer.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- observer → RefenaObserver?
-
The provided observer (e.g. for logging)
no setteroverride
- ownsContainer → bool
-
Has ownership of the RefenaContainer.
This is used to dispose the RefenaContainer when the widget is disposed.
final
- platformHint ↔ PlatformHint
-
The platform hint.
getter/setter pairoverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
accessor<
R> (BaseWatchable< BaseNotifier, dynamic, R> provider) → StateAccessor<R> -
Similar to Ref.read, but instead of returning the state right away,
it returns a StateAccessor to get the latest state later.
override
-
anyNotifier<
N extends BaseNotifier< (T> , T>BaseProvider< N, T> provider, [void onInitNotifier(BaseProvider<BaseNotifier, dynamic> , BaseNotifier)?]) → N -
Returns the notifier of a NotifierProvider.
This method is used internally without
any
NotifyableProvider
constraints.override -
cleanupListeners(
) → void -
Removes disposed listeners from all notifiers.
This happens regularly, but you can call it manually if you want to
to visualize the current state.
override
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< RefenaScope> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
dispatch<
R> (GlobalActionWithResult< R> action) → R -
Available on Ref, provided by the GlobalActionExtension extension
Dispatches a global action. Returns the result of the action. -
dispatchAsync<
R> (AsyncGlobalActionWithResult< R> action) → Future<R> -
Available on Ref, provided by the GlobalActionExtension extension
Dispatches an async global action. Returns the result of the action. -
dispose<
N extends BaseNotifier< (T> , T>BaseProvider< N, T> provider) → void -
Disposes a
provider
. Be aware that streams (ref.stream) are closed also. You may call this method in the dispose method of a stateful widget. Calling this method multiple times has no effect. Note: Theprovider
will be initialized again on next access.override -
disposeContainer(
) → void -
Disposes the container itself.
It will also dispose all providers.
After calling this method, the container should not be used anymore.
override
-
disposeFamilyParam<
N extends FamilyNotifier< (dynamic, P, dynamic> , P>BaseProvider< N, dynamic> provider, P param) → void -
Disposes the
param
of a familyprovider
. While the ordinary dispose method disposes the whole provider, this method only disposes theparam
. Calling this method multiple times has no effect.override -
ensureOverrides(
) → Future< void> -
Awaiting this future will ensure that all overrides are initialized.
Calling it multiple times is safe.
override
-
exists(
BaseProvider< BaseNotifier, dynamic> provider) → bool -
Whether the provider is initialized.
Usually, providers are initialized when you first access them.
They are also initialized when you override them.
They are getting disposed when you call Ref.dispose.
override
-
future<
N extends GetFutureNotifier< (T> , T>ProviderAccessor< BaseProvider< provider, [void onInitNotifier(BaseProvider<N, AsyncValue< , N, AsyncValue<T> >T> >BaseNotifier, dynamic> , BaseNotifier)?]) → Future<T> -
Get the Future of an AsyncNotifierProvider, FutureProvider or
StreamProvider.
override
-
getActiveNotifiers(
) → List< BaseNotifier> -
Returns all active notifiers.
Remember: A provider is stateless. The notifier holds the state.
override
-
getActiveProviders(
) → List< BaseProvider< BaseNotifier, dynamic> > -
Returns all active providers.
Remember: A provider is stateless. The notifier holds the state.
override
-
init(
) → void -
Initializes the RefenaContainer.
override
-
message(
String message) → void -
Emits a message to the observer.
This might be handy if you use RefenaTracingPage.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifier<
N extends BaseNotifier< (T> , T>NotifyableProvider< N, T> provider) → N -
Returns the notifier of a NotifierProvider.
override
-
read<
N extends BaseNotifier< (T> , T, R>BaseWatchable< N, T, R> watchable, [void onInitNotifier(BaseProvider<BaseNotifier, dynamic> , BaseNotifier)?]) → R -
Returns the actual value of a Provider.
override
-
rebuild<
N extends RebuildableNotifier< (T, R> , T, R>RebuildableProvider< N, T, R> provider, [LabeledReference? debugOrigin]) → R -
Rebuilds a rebuildable provider (e.g. ViewProvider, FutureProvider)
and returns the result of the builder function.
override
-
redux<
N extends ReduxNotifier< (T> , T>ReduxProvider< N, T> provider) → Dispatcher<N, T> -
Get a proxy class to dispatch actions to a ReduxNotifier.
override
-
set(
ProviderOverride< BaseNotifier, dynamic> override) → FutureOr<void> -
Overrides a provider with a new value.
This allows for overrides happening after the container was created.
override
-
stream<
N extends BaseNotifier< (T> , T>ProviderAccessor< BaseProvider< provider, [void onInitNotifier(BaseProvider<N, T> , N, T>BaseNotifier, dynamic> , BaseNotifier)?]) → Stream<NotifierEvent< T> > -
Listen for changes to a provider.
override
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultRef ↔ Ref
-
If you are unable to access the
ref
for whatever reason, there is a pragmatic solution for that. This is considered bad practice and should only be used as a last resort.getter/setter pair
Static Methods
-
getPlatformHint(
) → PlatformHint - Returns the PlatformHint for the current platform. This type is used to represent the platform type without depending on Flutter or dart:io.