Rating.newStarRating constructor Null safety

Rating.newStarRating(
  1. RatingStyle style,
  2. int rating
)

Creates a new star rating.

Implementation

Rating.newStarRating(RatingStyle style, int rating)
    : assert(
        style == RatingStyle.range3stars ||
            style == RatingStyle.range4stars ||
            style == RatingStyle.range5stars,
        'Invalid rating style',
      ),
      assert(rating >= 0 && rating <= style.index),
      _type = style,
      _value = rating;