$asyncComputed<U> function
- @Deprecated('Use KaeruWidget instead. This will be removed in a future version.')
Creates an instance of AsyncComputed with the given async function.
_getValue
: The function that fetches the computed value asynchronously.defaultValue
: A default value before the async computation completes.beforeUpdate
: A function to set a temporary value before computation.notifyBeforeUpdate
: If true, notifies listeners whenbeforeUpdate
sets a new value.onError
: Callback function for handling errors during async computation.immediate
: If true, starts the async computation immediately upon creation.
The AsyncComputed instance is automatically disposed when the widget is disposed.
Note: This is part of the deprecated defineWidget
API.
Implementation
@Deprecated('Use KaeruWidget instead. This will be removed in a future version.')
AsyncComputed<U> $asyncComputed<U>(final Future<U> Function() getValue,
{U? defaultValue,
U? Function()? beforeUpdate,
bool notifyBeforeUpdate = true,
void Function(dynamic error)? onError,
immediate = false}) =>
autoContextDispose(AsyncComputed<U>(getValue,
defaultValue: defaultValue,
beforeUpdate: beforeUpdate,
notifyBeforeUpdate: notifyBeforeUpdate,
onError: onError,
immediate: immediate));