RatingBar.readOnly constructor Null safety

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

Creates read only rating bar.

The filledIcon & emptyIcon must not be null.

Implementation

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