Skip to content

SolidProvider - async create function - adjustment possible? #54

Closed Answered by nank1ro
rainbowloop asked this question in Q&A
Discussion options

You must be logged in to vote

This is not currently feasible and I think it will be pretty hard to implement.
You can await the initialisation before creating the SolidProvider, for example:

class _ExampleWidgetState extends State<ExampleWidget> {
  late final resource = createResource(fetcher: PreferencesController.init);

  @override
  void dispose() {
    resource.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ResourceBuilder(
      resource: resource,
      builder: (context, resourceState) {
        return resourceState.on(
          ready: (preferencesController) {
            return Solid(
              providers: [
                SolidProvider<PreferencesCon…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rainbowloop
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