Fixed the bug where the rating couldn't be zero.
Hi Celebrity:
Thanks for the pull request. I'm not 100% sure that this is a bug.
Let's say that a recipe in the JSON array specifies 0 as the rating. That is, a recipe starts out with a rating of 0.
The starChar method will do the right thing: String starChar(int star) => rating == null || star > rating ? _STAR_OFF_CHAR : _STAR_ON_CHAR;
It returns _STAR_OFF_CHAR for each star because rating is less than even the lowest star int. (The stars[] always starts at 1.)
Now if a user clicks the first star and invokes handleClick(), "star == 1 && rating == 1" evaluates to false, so the method sets rating to 1 (the value of the first star).
void handleClick(int star) { rating = (star == 1 && rating == 1) ? 0 : star; }
What were you seeing that seemed like a bug?