How to skip build in item builder gridview.builder Flutter Firebase Stream Builder
The way I solved having these empty spaces in a grid is to filter the list of widgets before using them in the grid:
List visibleWidgets = allWidgets.where((widget) => widget.show == true).toList();