akbarpulatov / flutter_awesome_select

Forked from https://github.com/davigmacode/flutter_smart_select, updated legacy code, migrated to null safety and more. AwesomeSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.
https://pub.dev/packages/awesome_select
MIT License
48 stars 56 forks source link

Optional group and subtitle #55

Closed mauriziopinotti closed 5 months ago

mauriziopinotti commented 1 year ago

I am using

          _items = S2Choice.listFrom<T, T>(
            source: items!,
            value: (index, item) => item,
            title: (index, item) => item.title!,
            subtitle: (index, item) => item.subtitle,
            group: (index, item) => item.group,
            meta: (index, item) => item,
          );

where item.subtitle and item.group are String?.

This fails with The return type 'String?' isn't a 'String', as required by the closure's context.

Basically, subtitle and group can either be provided or not provided, but if provided it must not be null; I need to provide it as null.

I fixed this locally and will submit a PR.