Replies: 2 comments 7 replies
-
Something like the following should work I'd think, but hasn't been tested. Future<void> main() async {
final container = CapsuleContainer()..read(aWarmUpCapsule)..read(bWarmUpCapsule);
await (use(aAsyncCapsule), use(bAsyncCapsule)).wait;
// do whatever with aCapsule and bCapsule
}
Future<int> aAsyncCapsule(CapsuleHandle use) async => throw 'impl hidden';
Future<bool> bAsyncCapsule(CapsuleHandle use) async => throw 'impl hidden';
AsyncValue<int> aWarmUpCapsule(CapsuleHandle use) => use.future(use(aAsyncCapsule));
AsyncValue<bool> bWarmUpCapsule(CapsuleHandle use) => use.future(use(bAsyncCapsule));
int aCapsule(CapsuleHandle use) => (use(aWarmUpCapsule) as AsyncData).data;
bool bCapsule(CapsuleHandle use) => (use(bWarmUpCapsule) as AsyncData).data; |
Beta Was this translation helpful? Give feedback.
1 reply
-
Seems a cool way ! |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can you suggest a technique to warming up capsules in a backend app?
Beta Was this translation helpful? Give feedback.
All reactions