Searching for Dependency Injection solutions for Flutter, I found two awesome libraries: provider
and get_it
.
As far as I can see, provider
has more boilerplate, but it fits really nicely with Flutter, allowing Consumer
to rebuild parts of the Widget
tree, once an injected value change.
get_it
on the other hand is more straightforward, easier to use, and not dependant on Flutter, so can be used with any Dart code.
Are there any more differences and limitations between them? I know this is kinda opinionated, but Flutter is so new that it's good to register publicly benefits, side-effects and gotchas.