How to remove item from Grid when using custom DataProvider?

Hi, every one.

Please help.(Vaadin 13)

Grid<Lead> grid = new Grid<>()
grid.setPageSize(15);
....colums
	
	grid.addColumn(new IconRenderer<>(object 
	   Button btnRemove = new Button();
       btnRemove.setIcon(new Icon(VaadinIcon.TRASH));
	   btnRemove.addClickListener(e->{
                   DaoLead.delete(object);//remove from database
				   
				   /*This code works when I'am using default provider, but return cast error when i'am using custom data provider
                    ListDataProvider<Lead> dataProvider = (ListDataProvider<Lead>) grid.getDataProvider();
                    dataProvider.getItems().remove(object);
                    dataProvider.refreshAll();
                   */

            });
	   return btnRemove;
	 },item -> "")).setWidth("120px");
	 
	

        DataProvider<Lead, Void> myDataProvider = DataProvider.fromCallbacks(
                // First callback fetches items based on a query

                query -> {
                    // The index of the first item to load
                    int offset = query.getOffset();

                    // The number of items to load
                    int limit = query.getLimit();

                    List<Lead> list = DaoLead.fetchLeads(offset,limit,Lead.class.getSimpleName());
                  
                    return list.stream();

                },
                // Second callback fetches the number of items for a query

                query -> DaoLead.getLeadCount(Lead.class.getSimpleName())
        );

        grid.setDataProvider(myDataProvider);
		
	

In console output: java.lang.ClassCastException: com.vaadin.flow.data.provider.CallbackDataProvider cannot be cast to com.vaadin.flow.data.provider.ListDataProvider

grid.getDataProvider().refreshAll(); should do it, assuming you have implemented your DataProvider correctly. You don’t need to cast it as a ListDataProvider.

Thanks)