confirmDialog method Null safety

dynamic confirmDialog(
  1. BuildContext context,
  2. List<DialogChoice<T>>? selectedChoices
)

Implementation

confirmDialog(BuildContext context, List<DialogChoice<T>>? selectedChoices) {
  if ((selectedChoices ?? []).isNotEmpty) {
    Navigator.of(context)
        .pop(selectedChoices!.map<T>((e) => e.value).toList());
  }
}