itemCount property

int get itemCount

包含header和footer的列表元素数量 如果showEmptyViewWhenListEmpty=true,即列表数据为空即使有header或footer也展示EmptyView, 当列表为空时实际的itemCount为header+footer+1

Implementation

int get itemCount {
  var headAndFootLength = _headers.length + _footers.length;

  if (mEmptyConfig?.showEmptyViewWhenListEmpty == true &&
      items.isEmpty &&
      headAndFootLength > 0) {
    return headAndFootLength + 1;
  }
  return headAndFootLength + items.length;
}