Search code examples
flutterflutter-getx

How to use Getx state management without using Getview?


My friends and I are doing a project with Flutter.He doens't use any state management method and I want to use Getx.So how can i use Getx without using Getview class so that our both codes work in a harmony?enter image description here


Solution

  • try this...

    class MyView extends StatelessWidget {
      // you can also put it here
      final controller = Get.put(MyController());
      @override
      Widget build(BuildContext context) {
       // you can put it here
       final controller = Get.put(MyController());
        return Text(
          controller.myText.value,
          style: Theme.of(context).textTheme.headline4,
        );
      }
    }
    

    either ways try to play with it