Hi everyone am trying to show an alert popup in the listview in the flutter app with condition check but my pop is not showing below is my code please help

ListView _buildListViewOfDevices() {
    List<Container> containers = <Container>[];
    for (BluetoothDevice device in widget.devicesList) {
      if (device.name == 'Airbud Pro Plus') {
        Alert(
          context: context,
          title: 'Greetings',
          desc: 'you are using Apple Airbud Pro Plus',
        ).show();
      }


Solution 1: ammar

below is how you show an alert dialog:

ListView _buildListViewOfDevices(context) { //pass context as parameter
      List<Container> containers = <Container>[];
      for (BluetoothDevice device in widget.devicesList) {
        if (device.name == 'Airbud Pro Plus') {
          showDialog(
              context: context,
              builder: (context) => AlertDialog(
                    title: Text('greetings!!'),
                    content: Text("you are using Apple Airbud Pro Plus"),
                  ));
        }
      }
    }


Solution 2: Nagulan S

In case you are using rflutter_alert package:

function call example:

RaisedButton(
              child: Text('Basic Alert'),
              onPressed: () => _onBasicAlertPressed(context),
            ),

function body example:

_onBasicAlertPressed(context) {
    Alert(
            context: context,
            title: "RFLUTTER ALERT",
            desc: "Flutter is more awesome with RFlutter Alert.")
        .show();
  }

Reference link: https://github.com/RatelHub/rflutter_alert/tree/master/example