rrousselGit / provider

InheritedWidgets, but simple
https://pub.dev/packages/provider
MIT License
5.1k stars 509 forks source link

Dooes Create really needs a BuildContext? #299

Closed feinstein closed 4 years ago

feinstein commented 4 years ago

Create looks like this:

typedef Create<T> = T Function(BuildContext context);

But I can't think of a case where any Provider will have create: called outside a build() method, so context will always be available, isn't this redundant?

rrousselGit commented 4 years ago

Keep in mind that a BuildContext points to a very specific location in the widget tree, and that widgets uses unidirectional dataflow.

The context of your custom widget may not have access to the same things that the provider's context does.

feinstein commented 4 years ago

Hmm, ok, I can't see where this would be useful, but I will close it then.