int incrementCount(int count, int increment, int limit) { if (count + MIN > (limit - increment) + MIN) { throw StateError('Limit exceeded'); } return count + increment; }