showChoicesCheckBoxDialog<T> function Null safety

Future<List<T>?> showChoicesCheckBoxDialog<T>(
  1. BuildContext context,
  2. {Key? key,
  3. required Widget title,
  4. Widget? content,
  5. required List<DialogChoice<T>> choices,
  6. Widget? cancelWidget,
  7. Widget? confirmWidget,
  8. bool barrierDismissible = false,
  9. Color? barrierColor,
  10. bool useSafeArea = true,
  11. bool useRootNavigator = true,
  12. RouteSettings? routeSettings}

Displays a dialog with the choices informed in the parameter choices using checkboxes.

To close the dialog, the user must select one or more choices listed on the screen and click on the OK action, or when theCancel button is clicked.

Example of using the dialog:

String result = await showChoicesRadioDialog<String>(context,
    title: Text('Select user'),
    choices: [
            icon: Icon(Icons.person),
            title: Text('Ricardo Crescenti'),
            subtitle: Text(''),
            value: 'ricardo.crescenti'),
            icon: Icon(Icons.person),
            title: Text('Ana Luiza Crescenti'),
            subtitle: Text(''),
            value: 'analuiza.crescenti'),
            icon: Icon(Icons.person),
            title: Text('Luis Otavio Crescenti'),
            subtitle: Text(''),
            value: 'luisotavio.crescenti'),

if (result != null) {
    showBasicDialog(context, title: Text('Selected user'), content: Text(result));


Future<List<T>?> showChoicesCheckBoxDialog<T>(BuildContext context,
    {Key? key,
    required Widget title,
    Widget? content,
    required List<DialogChoice<T>> choices,
    Widget? cancelWidget,
    Widget? confirmWidget,
    bool barrierDismissible = false,
    Color? barrierColor,
    bool useSafeArea = true,
    bool useRootNavigator = true,
    RouteSettings? routeSettings}) async {
  List<T>? result = await _showChoicesDialog<T>(context,
      title: title,
      content: content,
      choiceType: DialogChoicesType.checkBok,
      choices: choices,
      cancelWidget: cancelWidget,
      okWidget: confirmWidget,
      barrierDismissible: barrierDismissible,
      barrierColor: barrierColor,
      useSafeArea: useSafeArea,
      useRootNavigator: useRootNavigator,
      routeSettings: routeSettings);

  return (result != null && result.isNotEmpty ? result : null);