@Riverpod(keepAlive: true)
Future<HomePageData> homeData(HomeDataRef ref) async {
final data = await Future.wait([
ref.watch(walletBalanceProvider.future),
ref.watch(marketTokensProvider.future),
ref.watch(tokenChangesProvider.future),
ref.watch(otcPairProvider.future),
]);
return HomePageData(
wallets: data[0] as List<Wallet>,
marketTokens: data[1] as List<Token>,
otcToken: data[2] as List<Token>,
otcPair: data[3] as List<OtcPair>,
);
}
我有这样的 homeDataProvider,
为什么当我调用 ref.invalidate(homeDataProvider) 时会返回错误,但一一使其失效却有效。
因为是keepAlive = true。也许其他的都不是单例。