useMemoized<T> function

T useMemoized<T>(
  1. T valueBuilder(), [
  2. List<Object?> keys = const <Object>[]

Caches the instance of a complex object.

useMemoized will immediately call valueBuilder on first call and store its result. Later, when the HookWidget rebuilds, the call to useMemoized will return the previously created instance without calling valueBuilder.

A subsequent call of useMemoized with different keys will re-invoke the function to create a new instance.


T useMemoized<T>(
  T Function() valueBuilder, [
  List<Object?> keys = const <Object>[],
]) {
  return use(
      keys: keys,