Closed DFreds closed 4 years ago
Yep, makes sense! Overall, the example will be almost Identical to the scoped_model
example.
Instead of extending the Model
class, you'll either mixin or extend the ChangeNotifier
class.
Instead of ScopedModel
/ ScopedModelDescendant
, you'd use ChangeNotifierProvider
& Consumer
.
I already created a similar app with provider
here.
I would like to contribute to this. I can submit a PR after making necessary changes.
@shakib609 Thanks for the example using Provider
, but after running the app, I see your app doesn't follow the app specification. It's better if you make it consistent with the spec.
@tuanbs I modified the ScopedModel example app to use Provider as @brianegan suggested. Did you by any chance check this app and not the PR #143?
@shakib609 Yes I checked and run that app but the UI is different from the app spec. I also checked the scoped_model example but I see it doesn't use provider
in pubspec.yaml
. Also, I'm able to run the scoped_model example on Android, but it doesn't work on iOS.
@tuanbs The app in my profile was not intended for this issue. Please check this one.
Hi @shakib609, thanks for this, it works now. I have to download the zip file (NOT the git clone ...
cli) from here to get the provider example.
Also, I found you have the tutorial for this provider-example, but it's about your old app. So I think you should update this tutorial with the new one.
@brianegan It's better if you could include the tutorial for each example in the README
file. For example, I found the flutter_bloc
example has this tutorial as well.
Anyway, thank you very much for your great jobs guys. I learned a lot from it. Cheers.
With the support of the new Provider library (as shown here), I think a new example would be worthwhile. It might help others weigh the pros and cons of it versus BLoC or Scoped Model.
Relevant docs: https://pub.dev/packages/provider