onRowDelete property

bool Function(int index, List row)? onRowDelete
final

Called when the user clicks on the delete icon of a row.

Return true to allow the delete action, false to prevent it.

If the delete action is allowed, the row will be deleted from the table.

bool onRowDelete(int index, List<dynamic> row){
//Do some validation on row and return false if validation fails
if (row[0] == null) {
   ScaffoldMessenger.of(context).showSnackBar(
    const SnackBar(
     content: Text("Name cannot be null"),
    ),
  );
 return false;
}
return true;
}

Implementation

final bool Function(int index, List<dynamic> row)? onRowDelete;