RadioListTile<T> constructor Null safety

const RadioListTile<T>(
  1. {Key? key,
  2. required T value,
  3. required T? groupValue,
  4. required ValueChanged<T?>? onChanged,
  5. bool toggleable = false,
  6. Color? activeColor,
  7. Widget? title,
  8. Widget? subtitle,
  9. bool isThreeLine = false,
  10. bool? dense,
  11. Widget? secondary,
  12. bool selected = false,
  13. ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
  14. bool autofocus = false,
  15. EdgeInsetsGeometry? contentPadding,
  16. ShapeBorder? shape,
  17. Color? tileColor,
  18. Color? selectedTileColor,
  19. VisualDensity? visualDensity,
  20. FocusNode? focusNode,
  21. bool? enableFeedback}
)

Creates a combination of a list tile and a radio button.

The radio tile itself does not maintain any state. Instead, when the radio button is selected, the widget calls the onChanged callback. Most widgets that use a radio button will listen for the onChanged callback and rebuild the radio tile with a new groupValue to update the visual appearance of the radio button.

The following arguments are required:

  • value and groupValue together determine whether the radio button is selected.
  • onChanged is called when the user selects this radio button.

Implementation

const RadioListTile({
  super.key,
  required this.value,
  required this.groupValue,
  required this.onChanged,
  this.toggleable = false,
  this.activeColor,
  this.title,
  this.subtitle,
  this.isThreeLine = false,
  this.dense,
  this.secondary,
  this.selected = false,
  this.controlAffinity = ListTileControlAffinity.platform,
  this.autofocus = false,
  this.contentPadding,
  this.shape,
  this.tileColor,
  this.selectedTileColor,
  this.visualDensity,
  this.focusNode,
  this.enableFeedback,
}) : assert(toggleable != null),
     assert(isThreeLine != null),
     assert(!isThreeLine || subtitle != null),
     assert(selected != null),
     assert(controlAffinity != null),
     assert(autofocus != null);