Data<T> class

A widget that provides the data to its descendants.

Inheritance
Implemented types

Constructors

Data(T data, {Key? key})
Creates a Data for MultiData.
const
Data.boundary({Key? key, Widget? child})
Creates a boundary Data widget that stops the data from being passed to its descendants.
const
Data.inherit({Key? key, required T data, Widget? child})
Creates a single Data widget.
const

Properties

child → Widget?
The child widget.
final
data → T
The data that will be provided to the descendants.
no setter
dataType → Type
The compile-time type of the data.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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
wrapWidget(Widget child) → Widget
Wraps the child widget with the data.
override

Operators

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

Static Methods

capture({required BuildContext from, required BuildContext? to}) → CapturedData
Capture all the data from another context.
captureAll(BuildContext context, Widget child, {BuildContext? to}) → Widget
Capture all the data from another context and wrap the child that can receive the data.
collect<T>(BuildContext context) → List<T>
Find and collect all the data of the given type from the context.
find<T>(BuildContext context) → T
Find the data of the given type from the context. Does not listen to the data changes.
findMessenger<T>(BuildContext context) → T
Find the stored data somewhere in the ancestor DataMessenger descendants. Throws an assertion error if the data is not found.
findRoot<T>(BuildContext context) → T
Find the root data of the given type from the context. Throws an assertion error if the data is not found.
maybeFind<T>(BuildContext context) → T?
Optionally find the data of the given type from the context.
maybeFindMessenger<T>(BuildContext context) → T?
Find the DataMessenger that holds all of the data with the given type from the context.
maybeFindRoot<T>(BuildContext context) → T?
Optionally find the root data of the given type from the context.
maybeOf<T>(BuildContext context) → T?
Optionally find and listen to data changes of the data with the given type from the context.
of<T>(BuildContext context) → T
Find and listen to data changes of the data with the given type from the context.
visitAncestors<T>(BuildContext context, bool visitor(T data)) → void
Visit all Data ancestors of the given type from the context.