Flutter delete and update an item from listview and db

I want to remove an entry from listview and db at the same time using swipe like this:

onPressed: () {
      // Delete the item from DB 
      setState(() {
      data.indexOf(data[index]);
      data.removeAt(index);
      });
     Navigator.of(context).pop();
     },

the methode doesn’t seem to be working also i want help with how can I trigger the update on this page without the user to reopen the page.

return ListView.builder(
                      itemCount: snapshot.data.length,
                      itemBuilder: (context, index) {
                        List<Ia> data = snapshot.data;
                        print(data);
                        return Dismissible(
                          background: slideRightBackground(),
                          secondaryBackground: slideLeftBackground(),
                          key: Key(data[index].toString()),
                          // ignore: missing_return
                          confirmDismiss: (direction) async {
                            if (direction == DismissDirection.endToStart) {
                              final bool res = await showDialog(
                                  context: context,
                                  builder: (BuildContext context) {
                                    return AlertDialog(
                                      content: Text(
                                          "Are you sure you want to delete                                   `                                              ${data[index]}?"),`
                                      actions: <Widget>[
                                        // ignore: deprecated_member_use
                                        FlatButton(
                                          child: Text(
                                            "Cancel",
                                            style:
                                                TextStyle(color: Colors.black),
                                          ),
                                          onPressed: () {
                                            Navigator.of(context).pop();
                                          },
                                        ),
                                        FlatButton(
                                          child: Text(
                                            "Delete",
                                            style: TextStyle(color: Colors.red),
                                          ),
                                          onPressed: () {
                                            // Delete the item from DB 
                                            setState(() {
                                              data.indexOf(data[index]);
                                              data.removeAt(index);
                                            });
                                            Navigator.of(context).pop();
                                          },
                                        ),
                                      ],
                                    );
                                  });
                              return res;
                            } else {
                              // Navigate to edit page;
                            }
                          },
                          child: Card(
                            child: ListTile(
                              title: Text(data[index].name,
                                  style: TextStyle(fontSize: 16)),
                              subtitle: Row(
                                children: [
                                  Text(
                                    "Status",
                                    style: TextStyle(
                                        fontSize: 12,
                                        fontWeight: FontWeight.bold),
                                  ),
                                  SizedBox(
                                    width: 5,
                                  ),
                                  Text(
                                    data[index].state,
                                    style: TextStyle(
                                      color: Colors.lightBlue,
                                      fontSize: 12,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                        );
                      });

im developping a flutter mobile app with odoo api, this is an example in the odoo rest api documentation DELETE /api/product.template/?filter=[[“id”, “=”, 95]] but i don’t know how to use it with the swipe delete method