1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-15 10:04:13 +01:00
lemmur-app-android/lib/hooks/memo_future.dart
2020-09-30 17:05:00 +00:00

9 lines
418 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
/// creates an [AsyncSnapshot] from the Future returned from the valueBuilder.
/// [keys] can be used to rebuild the Future
AsyncSnapshot<T> useMemoFuture<T>(Future<T> Function() valueBuilder,
[List<Object> keys = const <dynamic>[]]) =>
useFuture(useMemoized<Future<T>>(valueBuilder, keys), preserveState: false);