server library
Server-specific Jaspr APIs.
Classes
- AppBinding
- Main class that provide services (also known as "bindings").
- AsyncBuildableElement
- An element with an async build method.
- AsyncBuilder
- The async variant of a Builder component.
-
AsyncSnapshot<
T> - Immutable representation of the most recent interaction with an asynchronous computation.
- AsyncStatelessComponent
- The async variant of a stateless component.
- AsyncStatelessElement
- An Element that uses a AsyncStatelessComponent as its configuration.
- AttachAdapter
- AttachDocument
- BaseDocument
- 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.
- ChildListRange
- ChildNodeData
- ClientAnnotation
- Use with client to annotate a client component.
-
ClientTarget<
T extends Component> - The target configuration for a @client component.
- 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
- Element
- An instantiation of a Component at a particular location in the tree.
- ElementBoundaryAdapter
- ElementSlot
- EncoderAnnotation
- Use with encoder to annotate an encoder function for a custom model.
-
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.Nodethat 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.
- HeadDocument
- HeadScopeAdapter
- 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 server.
- 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.
- MarkupRenderElement
- MarkupRenderFragment
- MarkupRenderObject
- MarkupRenderText
- 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
- RenderAdapter
- RenderElement
- RenderFragment
- RenderObject
- RenderText
- Request
- An HTTP request to be processed by a Shelf application.
- Response
- The response returned by a Handler.
- RootMarkupRenderObject
- ServerApp
- An object to be returned from runApp on the server and provide access to the internal http server.
- ServerAppBinding
- Global component binding for the server.
- ServerOptions
- Global options for configuring Jaspr on the server.
-
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.
- TemplateDocument
- TemplateDocumentAdapter
- 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
- 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
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 thatmmust either be abstract or must return a newly allocated object ornull. In addition, every method that either implements or overridesmis implicitly annotated with this same annotation. - immutable → const Immutable
-
Used to annotate a class
C. Indicates thatCand all subtypes ofCmust 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 overridesmmust also invokem. In addition, every method that overridesmis implicitly annotated with this same annotation. - nonVirtual → const _NonVirtual
-
Used to annotate an instance member (method, getter, setter, operator, or
field)
min a classCor mixinM. Indicates thatmshould not be overridden in any classes that extend or mixinCorM. - optionalTypeArgs → const _OptionalTypeArgs
-
Used to annotate a class, mixin, extension, function, method, or typedef
declaration
C. Indicates that any type arguments declared onCare 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
toStringon Object.runtimeType. -
renderComponent(
Component app, {Request? request, bool standalone = false}) → Future< ResponseLike> - Directly renders the provided component to HTML. Returns a ResponseLike object.
-
runApp(
Component app) → void - Main entry point on the server.
-
serveApp(
AppHandler handler) → Handler - Returns a shelf handler that serves the provided component and related assets.
-
shortHash(
Object? object) → String - Returns a 5 character long hexadecimal string generated from Object.hashCode's 20 least-significant bits.
Typedefs
-
AppHandler
= FutureOr<
Response> Function(Request, RenderFunction render) -
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.
- ComponentBuilder = Component Function(BuildContext context)
- Signature for a function that creates a component, e.g. StatelessComponent.build or State.build.
- ElementVisitor = void Function(Element element)
- Signature for the callback to BuildContext.visitChildElements.
- EventCallback = void Function(Event event)
-
FileLoader
= Future<
String?> Function(String) -
Handler
= FutureOr<
Response> Function(Request request) - A function which handles a Request.
-
IterableFilter<
T> = Iterable< T> Function(Iterable<T> input) - Signature for callbacks that filter an iterable.
-
RenderFunction
= FutureOr<
Response> Function(Component) -
ResponseLike
= ({Uint8List body, Map<
String, List< headers, int statusCode})String> > - A record containing the status code, body, and headers for a response.
- SetupFunction = void Function(ServerAppBinding binding)
- 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.