overrideWithBuild method
- FutureOr<
EntitySnapshot< build<T> >T extends Object>()
Overrides the build method of a notifier, allowing you to replace the
default implementation with a custom one for testing or specific use cases.
This override affects only the build method of the notifier, leaving
the rest of the provider's behavior unchanged. It is useful when you want
to customize the notifier's initialization logic without altering other
aspects of the provider.
Implementation
Override overrideWithBuild(
FutureOr<EntitySnapshot<T>> Function<T extends Object>(
Ref ref,
Entity<T> notifier,
)
build,
) => $FamilyOverride(
from: this,
createElement: (pointer) {
final provider = pointer.origin as EntityProvider;
return provider._captureGenerics(<T extends Object>() {
provider as EntityProvider<T>;
return provider
.$view(runNotifierBuildOverride: build<T>)
.$createElement(pointer);
});
},
);