rrousselGit / state_notifier

ValueNotifier, but outside Flutter and with some extra perks
MIT License
311 stars 28 forks source link

Loading state async from a Http Endpoint #55

Closed pwlan closed 3 years ago

pwlan commented 3 years ago

Describe what scenario you think is uncovered by the existing examples/articles

Loading the state of a StateNotifier on start from an external http endpoint. There are 2 questions here:

  1. Can state be set in the body of an "async" callback?
  2. Is it "allowed" to load data in this manner in the StateNotifier constructor? Or is there a better place for that code?

Describe why existing examples/articles do not cover this case

I could not find any example.

Additional context

-

Maybe the answers are obvious. But I was uncertain.

rrousselGit commented 3 years ago

Can state be set in the body of an "async" callback?

Yes

Is it "allowed" to load data in this manner in the StateNotifier constructor? Or is there a better place for that code?

Sure, that's alright

pwlan commented 3 years ago

Great. Thanks for the reply..... and also great framework!