RefenaScope class

A wrapper widget around RefenaContainer.

Inheritance
Implemented types
Available Extensions

Constructors

RefenaScope({Key? key, PlatformHint? platformHint, List<ProviderOverride<BaseNotifier, dynamic>> overrides = const [], List<BaseProvider<BaseNotifier, dynamic>> initialProviders = const [], NotifyStrategy defaultNotifyStrategy = NotifyStrategy.identity, List<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

anyNotifier<N extends BaseNotifier<T>, T>(BaseProvider<N, T> provider) → 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
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. Note: The provider 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>, P>(BaseProvider<N, dynamic> provider, P param) → void
Disposes the param of a family provider. While the ordinary dispose method disposes the whole provider, this method only disposes the param.
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 AsyncNotifier<T>, T>(AsyncNotifierProvider<N, T> provider) Future<T>
Get the Future of an AsyncNotifierProvider.
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
internalDispose<N extends BaseNotifier<T>, T>(BaseProvider<N, T> provider, LabeledReference debugOrigin) → void
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>(Watchable<N, T, R> watchable) → R
Returns the actual value of a Provider.
override
redux<N extends BaseReduxNotifier<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>(BaseProvider<N, T> provider) 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}) 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.