client library

Client-specific Jaspr APIs.

Classes

AppBinding
Main class that provide services (also known as "bindings").
AsyncSnapshot<T>
Immutable representation of the most recent interaction with an asynchronous computation.
BuildableElement
An Element that has a build method.
BuildContext
The BuildContext supplied to a Components build() method.
Builder
A stateless utility component whose build method uses its builder callback to create the component's child.
BuildOwner
CachingIterable<E>
A lazy caching version of Iterable.
ChangeNotifier
A class that can be extended or mixed in that provides a change notification API using VoidCallback for notifications.
ClientAnnotation
Use with client to annotate a client component.
ClientApp
Locates and initializes @client components during hydration.
ClientAppBinding
Global component binding for the client.
ClientLoader
The loader configuration for a @client component.
ClientOptions
Global options for configuring Jaspr on the client.
Component
Describes the configuration for an Element.
DecoderAnnotation
Use with decoder to annotate an decoder function for a custom model.
Document
DomComponent
Represents a html element in the DOM
DomElement
DomRenderElement
DomRenderFragment
DomRenderObject
DomRenderText
Element
An instantiation of a Component at a particular location in the tree.
ElementSlot
EncoderAnnotation
Use with encoder to annotate an encoder function for a custom model.
EventBinding
Factory<T>
A factory interface that also reports the type of the created objects.
Fragment
A utility component that renders its children without any wrapper element.
FutureBuilder<T>
Component that builds itself based on the latest snapshot of interaction with a Future.
GlobalKey
A key that is unique across the entire app.
GlobalNodeKey<T extends Node>
A global key that provides access to the dom web.Node that is associated with its element.
GlobalObjectKey
A global key that takes its identity from the object used as its value.
GlobalObjectNodeKey<T extends Node>
A global node key that takes its identity from the object used as its value.
GlobalObjectStateKey<T extends State<StatefulComponent>>
A global state key that takes its identity from the object used as its value.
GlobalStateKey<T extends State<StatefulComponent>>
A global key that provides access to the State that is associated with its element.
Import
Define a platform specific import with auto-generated stubbing.
InheritedComponent
Base class for components that efficiently propagate information down the tree.
InheritedElement
An Element that uses an InheritedComponent as its configuration.
InheritedModel<T>
InheritedModelElement<T>
Jaspr
Main class for initializing the Jaspr framework on the client.
JasprBadge
A "Built with Jaspr" badge component.
Key
A Key is an identifier for Components and Elements.
LabeledGlobalKey
A global key with a debugging label.
LabeledGlobalNodeKey<T extends Node>
A global node key with a debugging label.
LabeledGlobalStateKey<T extends State<StatefulComponent>>
A global state key with a debugging label.
LeafElement
LeafRenderObjectElement
Listenable
An object that maintains a list of listeners.
ListenableBuilder
LocalKey
A key that is not a GlobalKey.
MultiChildElement
An Element that has multiple children based on a proxy list.
MultiChildRenderObjectElement
Notification
A notification that can bubble up the component tree.
ObserverComponent
Base class for components that observes the build execution of it's descendants in the Component tree.
ObserverElement
An Element that uses an ObserverComponent as its configuration. You can override willRebuildElement, didRebuildElement and didUnmountElement to execute the required logic.
RawableRenderObject
RawableRenderText
RenderElement
RenderFragment
RenderObject
RenderText
RootDomRenderObject
State<T extends StatefulComponent>
The logic and internal state for a StatefulComponent.
StatefulBuilder
A platonic component that both has state and calls a closure to obtain its child component.
StatefulComponent
A component that has mutable state.
StatefulElement
An Element that uses a StatefulComponent as its configuration.
StatelessComponent
A component that does not require mutable state.
StatelessElement
An Element that uses a StatelessComponent as its configuration.
StreamBuilder<T>
Component that builds itself based on the latest snapshot of interaction with a Stream.
StreamBuilderBase<T, S>
Base class for components that build themselves based on interaction with a specified Stream.
SyncAnnotation
SynchronousFuture<T>
A Future whose then implementation calls the callback immediately.
Text
Represents a plain text node with no additional properties.
TextElement
UniqueKey
A key that is only equal to itself.
ValueKey<T>
A key that uses a value of a particular type to identify itself.
ValueListenable<T>
An interface for subclasses of Listenable that expose a value.
ValueListenableBuilder<T>
ValueNotifier<T>
A ChangeNotifier that holds a single value.

Enums

ConnectionState
The state of connection to an asynchronous computation.
ImportPlatform
SchedulerPhase

Mixins

ComponentsBinding
Main app binding, controls the root component and global state
HydratableDomRenderObject
MultiChildDomRenderObject
NotifiableElementMixin
Mixin this class to allow receiving Notification objects dispatched by child elements.
OnFirstBuild
Mixin on StatelessComponent that performs some async task on the first build
PreloadStateMixin<T extends StatefulComponent>
Mixin on State that preloads state on the server
RenderObjectElement
SchedulerBinding
SyncStateMixin<T extends StatefulComponent, U>
Mixin on State that syncs state data from the server to the client.

Extensions

AppContext on BuildContext
AttributeOperation on Element

Constants

client → const ClientAnnotation
Used to annotate a client component.
decoder → const DecoderAnnotation
Used to annotate an decoder function for a custom model.
encoder → const EncoderAnnotation
Used to annotate an encoder function for a custom model.
factory → const _Factory
Used to annotate an instance or static method m. Indicates that m must either be abstract or must return a newly allocated object or null. In addition, every method that either implements or overrides m is implicitly annotated with this same annotation.
immutable → const Immutable
Used to annotate a class C. Indicates that C and all subtypes of C must be immutable.
kDebugMode → const bool
A constant that is true if the application was compiled in debug mode.
kGenerateMode → const bool
A constant that is true if the application is running in static-site-generation mode.
kIsWasm → const bool
A constant that is true if the application was compiled to WebAssembly.
kIsWeb → const bool
A constant that is true if the application was compiled to run on the web.
kReleaseMode → const bool
A constant that is true if the application was compiled in release mode.
kVerboseMode → const bool
A constant that is true if the application was run in verbose mode.
mustCallSuper → const _MustCallSuper
Used to annotate an instance member (method, getter, setter, operator, or field) m. Indicates that every invocation of a member that overrides m must also invoke m. In addition, every method that overrides m is implicitly annotated with this same annotation.
nonVirtual → const _NonVirtual
Used to annotate an instance member (method, getter, setter, operator, or field) m in a class C or mixin M. Indicates that m should not be overridden in any classes that extend or mixin C or M.
optionalTypeArgs → const _OptionalTypeArgs
Used to annotate a class, mixin, extension, function, method, or typedef declaration C. Indicates that any type arguments declared on C are to be treated as optional.
protected → const _Protected
Used to annotate an instance member in a class or mixin which is meant to be visible only within the declaring library, and to other instance members of the class or mixin, and their subtypes.
sync → const SyncAnnotation
visibleForTesting → const _VisibleForTesting
Used to annotate a declaration that was made public, so that it is more visible than otherwise necessary, to make code testable.

Functions

describeIdentity(Object? object) String
Returns a summary of the runtime type and hash code of object.
lerpDuration(Duration a, Duration b, double t) Duration
Linearly interpolate between two Durations.
objectRuntimeType(Object? object, String optimizedValue) String
Framework code should use this method in favor of calling toString on Object.runtimeType.
runApp(Component app, {String attachTo = 'body'}) ClientAppBinding
Main entry point for the browser app.
shortHash(Object? object) String
Returns a 5 character long hexadecimal string generated from Object.hashCode's 20 least-significant bits.

Typedefs

AsyncCallback = Future<void> Function()
Signature of callbacks that have no arguments and return no data, but that return a Future to indicate when their work is complete.
AsyncComponentBuilder<T> = Component Function(BuildContext context, AsyncSnapshot<T> snapshot)
Signature for strategies that build components based on asynchronous interaction.
AsyncValueGetter<T> = Future<T> Function()
Signature for callbacks that are to asynchronously report a value on demand.
AsyncValueSetter<T> = Future<void> Function(T value)
Signature for callbacks that report that a value has been set and return a Future that completes when the value has been saved.
ClientBuilder = Component Function(Map<String, dynamic> params)
The builder function type for a @client component.
ComponentBuilder = Component Function(BuildContext context)
Signature for a function that creates a component, e.g. StatelessComponent.build or State.build.
DomEventCallback = void Function(Event event)
ElementVisitor = void Function(Element element)
Signature for the callback to BuildContext.visitChildElements.
EventCallback = void Function(Event event)
IterableFilter<T> = Iterable<T> Function(Iterable<T> input)
Signature for callbacks that filter an iterable.
StatefulComponentBuilder = Component Function(BuildContext context, StateSetter setState)
Signature for the builder callback used by StatefulBuilder.
StateSetter = void Function(VoidCallback fn)
The signature of State.setState functions.
ValueChanged<T> = void Function(T value)
Signature for callbacks that report that an underlying value has changed.
ValueGetter<T> = T Function()
Signature for callbacks that are to report a value on demand.
ValueSetter<T> = void Function(T value)
Signature for callbacks that report that a value has been set.
VoidCallback = void Function()
Signature of callbacks that have no arguments and return no data.