Skip to content

Factories #21

Closed Answered by GregoryConrad
busslina asked this question in Q&A
Dec 18, 2023 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

Hi! 👋

It depends on where the factory is being used from.

  • If it is local to a Widget, you can use.memo() and/or use.future() from within a RearchConsumer.
  • If it is global to the application (i.e., only one user at a time), you can keep capsule(s) for the current factory argument(s), and then make another capsule for the output from the factory:
(String, void Function(String)) currOsUserCapsule(CapsuleHandle use) => use.state("");
Future<OsUserInfo?> Function(String username) osUserInfoFactory(CapsuleHandle use) => ...;
Future<OsUserInfo?> currOsUserInfoAsyncCapsule(CapsuleHandle use) => use(osUserInfoFactory)(use(currOsUserCapsule));
AsyncValue<OsUserInfo?> currOsUserInfoCapsule(Capsule…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@busslina
Comment options

@GregoryConrad
Comment options

Answer selected by GregoryConrad
Comment options

You must be logged in to vote
3 replies
@GregoryConrad
Comment options

@GregoryConrad
Comment options

@busslina
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants