Professional Documents
Culture Documents
Using The Get - It Flutter Package: What Is Getit?
Using The Get - It Flutter Package: What Is Getit?
Using The Get - It Flutter Package: What Is Getit?
This article will explain what get_it is, check different registration
methods, and give an example of how to use it in a Flutter application.
What is GetIt?
The get_it package is a service locator, in which you would have a
central registry where you can register the classes and then obtain an
instance of those classes. That can help us to obtain clean code and to
have a loosely coupled system.
Click CTRL + S to save, and you have successfully added get_it to your
Flutter application!
Example Using GetIt
So first to use it in your code you need to create an instance of GetIt
which can be done using two ways:
This would print Ahmed in the terminal. Also, don’t forget to call
getItInit() inside the main() method:
I hope you enjoyed reading this flutter tutorial, please feel free to leave any
comments or feedback on this post!