riverpod
riverpod copied to clipboard
Detect possible optimization when chaining `await ref.watch`
One way applications can become slow is by executing code sequentially when it could be parallelized.
The l'inter could detect possible optimization when using Ref.watch and suggest a more efficient code.
Bad:
final a=await ref.watch(a.future)
final b =await ref.watch(a.future)
May I ask a better way? Future.wait loses type safety.
@lishaduck This works in dart:
final (a, b) = await (ref.watch(a.future), ref.watch(b.future)).wait;
Disclaimer: I am not deeply familiar with Riverpod internals, so there may be a more idiomatic way to achieve this within Riverpod.