2020-09-15 15:20:34 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
|
|
2020-09-30 19:05:00 +02:00
|
|
|
/// creates an [AsyncSnapshot] from the Future returned from the valueBuilder.
|
|
|
|
/// [keys] can be used to rebuild the Future
|
2021-09-12 22:47:05 +02:00
|
|
|
AsyncSnapshot<T> useMemoFuture<T>(
|
2021-08-26 00:26:17 +02:00
|
|
|
Future<T> Function() valueBuilder, [
|
|
|
|
List<Object?> keys = const <Object>[],
|
|
|
|
]) =>
|
|
|
|
useFuture(
|
|
|
|
useMemoized<Future<T>>(valueBuilder, keys),
|
|
|
|
preserveState: false,
|
|
|
|
initialData: null,
|
|
|
|
);
|