CHB61 / multi_select_flutter

A flexible multi select package for Flutter. Make multi select widgets the way you want.
https://pub.dev/packages/multi_select_flutter
BSD 2-Clause "Simplified" License
238 stars 223 forks source link

Error: The argument type 'List<V>?' can't be assigned to the parameter type 'List<V>' #187

Open subhadippramanik opened 1 year ago

subhadippramanik commented 1 year ago

I am trying to set initialValue. My code looks like

MultiSelectBottomSheetField<Interest>(
                              initialChildSize: 0.4,
                              listType: MultiSelectListType.CHIP,
                              searchable: true,
                              buttonText: Text(item.key),
                              title: Text('Select ${item.key}'),
                              buttonIcon:
                                  Icon(CupertinoIcons.arrow_down_circle),
                              items: item.value
                                  .map((e) => MultiSelectItem(e, e.name))
                                  .toList(),
                              initialValue:
                                  initialInterests[item.key] ?? List.empty(),
                              onConfirm: (values) =>
                                  handleSave(item.key, values),
                              chipDisplay: MultiSelectChipDisplay(
                                  // onTap: (value) =>
                                  //     handleDelete(item.key, value),
                                  ),
                            ),
                          )

I am getting the following error

../../.pub-cache/hosted/pub.dev/multi_select_flutter-4.1.3/lib/bottom_sheet/multi_select_bottom_sheet_field.dart:169:31: Error: The argument type 'List<V>?' can't be assigned to the parameter type 'List<V>' because 'List<V>?' is nullable and 'List<V>' isn't.
 - 'List' is from 'dart:core'.
                initialValue: initialValue,
                              ^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script '/Users/subhadip/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1201

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/subhadip/Developer/flutter/bin/flutter'' finished with non-zero exit value 1

My package version is 4.1.3

arcbueno commented 1 year ago

I am getting the same error, don't know why

valterh4ck3r commented 9 months ago

Same error here

edithbefin commented 9 months ago

same error

edithbefin commented 9 months ago

Screenshot 2024-01-08 220352