BloomLazyComponent class

Caches an asynchronous component loader, ensuring the loader executes at most once across renders.

Wraps an async component factory Future<BloomNode> Function() and memoizes its resulting Future. Subsequent calls to load return the cached future immediately without repeating network operations or deferred chunk downloads. To discard the cached result and force a reload, call reset.

final lazySettings = BloomLazyComponent(() async {
  return const Div(
    className: 'settings-panel',
    text: 'Account Settings',
  );
});
final node = await lazySettings.load();

Constructors

BloomLazyComponent(Future<BloomNode> loader())
Creates a BloomLazyComponent wrapping the provided asynchronous loader.

Properties

hashCode int
The hash code for this object.
no setterinherited
loader Future<BloomNode> Function()
The asynchronous component factory that produces the BloomNode.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

load() Future<BloomNode>
Returns the cached load Future, invoking loader on the first call only.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Clears the cached Future, forcing the next load call to re-execute loader.
toString() String
A string representation of this object.
inherited

Operators

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