RatingBar constructor Null safety

const RatingBar(
  1. {Key? key,
  2. required IconData filledIcon,
  3. required IconData emptyIcon,
  4. required void onRatingChanged(
    1. double
    )?,
  5. double initialRating = 0.0,
  6. int maxRating = 5,
  7. IconData? halfFilledIcon,
  8. bool isHalfAllowed = false,
  9. Alignment alignment = Alignment.centerLeft,
  10. Axis direction = Axis.horizontal,
  11. Color filledColor = Colors.amber,
  12. Color emptyColor = Colors.grey,
  13. Color halfFilledColor = Colors.amber,
  14. double size = 32}
)

Default constructor for RatingBar.

Implementation

const RatingBar({
  Key? key,
  required this.filledIcon,
  required this.emptyIcon,
  required this.onRatingChanged,
  this.initialRating = 0.0,
  this.maxRating = 5,
  this.halfFilledIcon,
  this.isHalfAllowed = false,
  this.alignment = Alignment.centerLeft,
  this.direction = Axis.horizontal,
  this.filledColor = Colors.amber,
  this.emptyColor = Colors.grey,
  this.halfFilledColor = Colors.amber,
  this.size = 32,
})  : _readOnly = false,
      assert(
        !isHalfAllowed || halfFilledIcon != null,
        'Please provide halfFilledIcon if isHalfAllowed is true.',
      ),
      super(key: key);