tp7309 / flutter_sticky_and_expandable_list

粘性头部与分组列表Sliver实现 Build a grouped list, which support expand/collapse section and sticky headers, support use it with sliver widget.
MIT License
140 stars 29 forks source link

Null check operator exception on headerBuilder #39

Closed swch01 closed 2 years ago

swch01 commented 2 years ago

The headerBuilder parameter to SliverExpandableChildDelegate is nullable but its implementation expects a value.

https://github.com/tp7309/flutter_sticky_and_expandable_list/blob/9a152581a22e49e461b3f27c40eaaf137618a903/lib/src/sliver_expandable_list.dart#L172

tp7309 commented 2 years ago

sectionBuilder or headerBuilder, at least one.

swch01 commented 2 years ago

Perhaps this assert

https://github.com/tp7309/flutter_sticky_and_expandable_list/blob/9a152581a22e49e461b3f27c40eaaf137618a903/lib/src/sliver_expandable_list.dart#L135

could become

      : assert(
          (headerBuilder != null && sectionBuilder == null) ||
              (headerBuilder == null && sectionBuilder != null),
          'You must specify either headerBuilder or sectionBuilder.',
        ),
tp7309 commented 2 years ago

ok, i will commit it.