Skip to content

ScopeBuilder

Rebuilds a subtree when its nearest Scope changes or its value notifies.

Learn more: State management

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

ScopeBuilder<Project>(
builder: (context, project) => Text('Project: ${project.name}'),
)

The widget form of BuildContext.scope: it reads exactly what context.scope<T>() reads and subscribes the same way, but rebuilds only this builder rather than the enclosing widget. A nullable type argument (ScopeBuilder<Model?>) makes the scope optional. The scope keeps ownership of its value.

ParameterTypeDefaultDescription
builder:Widget Function(BuildContext context, T value)requiredBuilds from the nearest scoped value whenever it changes or notifies.

ScopeBuilder is defined in packages/fleury/lib/src/widgets/scope.dart.

Category: State & async · All widgets