avgRating property
num
get
avgRating
Average user rating in stars (1 star to 5 stars). Returns -1 if likeCount or dislikeCount is null.
Implementation
num get avgRating {
if (likeCount == null || dislikeCount == null) {
return -1;
}
if (likeCount! + dislikeCount! == 0) {
return 0;
}
return 1 + 4.0 * likeCount! / (likeCount! + dislikeCount!);
}