Flutter Getx Implementation

Neeraj Dana
Neeraj Dana

Today flutter have been one of the most used native mobile developement framework.Have recently gone through it and found flutter have library called Getx. It is everything which includes almost everything with no headache.Flutter getx have funcationality to manage routing, state , snackbar , bottom sheet , and more.

Today in this blog i am goinig to show how we can use flutter to implement Getx Library.
So before getting started i assume that you have some basic knowledge of flutter and also you would have install flutter in your machine.

Let's create a project name flutterState

flutter create flutterState

Now get in the newly created project and open it with your favourite code editor

After opening the project now let import th flutter Getx Library

  get: ^3.24.0

Now save it to install the required dependency after it has installed we are ready to use it.

First let's make our application realize that now we need our application to be manage by getx so we need to wrap our application in GetMaterialApp() head over to main.dart and remove you materialApp to GetMaterialApp()

      title: 'AnbyShop',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        scaffoldBackgroundColor: AnbyColors.pageBackgroundColor,
        fontFamily: "NHaasGroteskTXPro-RG",
        primarySwatch: Colors.orange,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      home: SplashScreen())

Now after doing this our application is Getx enabled .

That's it we have successfully implemented Getx in our project. Now in next blog we will learn about routing using Getx.