'Flutter Getx Snackbar not wroking

I have created a flutter app and used getx package. But then I used it to show the snack bar, the function gets executed but the snack bar is not showing up.

 onPressed: () {
        print("executed");
        Get.snackbar(
            "title",
            "content",
          ); 
        },


Solution 1:[1]

Change the MaterialApp() widget to GetMaterialApp() widget.

Solution 2:[2]

The only reason is you are not using GetMaterialApp() widget in the starting.

Solution 3:[3]

import 'package:flutter/material.dart';
import 'package:get/get.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      home: SafeArea(
        child: Scaffold(
          body: Center(
            child: ElevatedButton(
                onPressed: () {
                  print("executed");
                  Get.snackbar(
                    "title",
                    "content",
                  );
                },
                child: Icon(Icons.ac_unit)),
          ),
        ),
      ),
    );
  }
}

Solution 4:[4]

you have to change the MaterialApp() widget to GetMaterialApp() widget.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abhijith K
Solution 2 Md omer arafat
Solution 3 Yunus Kocatas
Solution 4 Pranesh Pyara Shrestha