How do you memoize your futures? I am using a FutureBuilder
that gets items data by some params.
I found here a suggestion to use AsyncMemoizer
, however it looks like it's missing from the dart:async
package.
Are there alternatives?
How do you memoize your futures? I am using a FutureBuilder
that gets items data by some params.
I found here a suggestion to use AsyncMemoizer
, however it looks like it's missing from the dart:async
package.
Are there alternatives?
First add dependency:
dart pub add async
Then import and use it:
import 'package:async/async.dart';
...
final _memoizer = AsyncMemoizer();