PodCollectionBuilder class

Observes a "source of pods" — a source Listenable whose changes imply that the set of inner pods to watch may have changed — and rebuilds when either:

  1. the source fires, or
  2. any pod currently returned by innerPods fires.

Subscription lifecycle for the inner pods is managed automatically — when the source changes, the widget re-invokes innerPods, diffs the new set against the current subscriptions by identity, adds new listeners, removes gone ones, and rebuilds.

Example

// `pJobServices` is a pod whose value is a list of services, each
// exposing a `.pData` pod. Rebuild when the list changes OR when any
// listed service's `.pData` fires.
PodCollectionBuilder(
  source: pJobServices,
  innerPods: () => pJobServices.getValue().map((s) => s.pData).toList(),
  builder: (context) => MyList(jobs: resolveCurrentJobs()),
)

Type compatibility

Accepts any Listenable — including Pod (via WeakChangeNotifier) and stock Flutter ValueNotifier/ChangeNotifier. For WeakChangeNotifiers the widget automatically uses addStrongRefListener so the internal tear-off isn't GC'd between fires; for plain Listenables it falls back to addListener.

Inheritance

Constructors

PodCollectionBuilder({Key? key, required Listenable source, required List<Listenable> innerPods(), required WidgetBuilder builder})
const

Properties

builder → WidgetBuilder
Builds the subtree. Rebuilt on every source fire and every inner-pod fire.
final
hashCode → int
The hash code for this object.
no setterinherited
innerPods → List<Listenable> Function()
Returns the current list of inner pods to subscribe to. Identity is significant — the builder uses identical() to diff against the previous subscription set.
final
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
source → Listenable
The source pod. Fires signal "the collection of inner pods may have changed." innerPods is invoked once at State.initState and again after every source fire.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<PodCollectionBuilder>
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
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

Operators

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