title: how to set highscore for quiz/game in flutter?
body: <p>first time when we open to set high score as 0, in flutter
  it will checked with score and update its value.
  i too used shared preferences it does not work.</p>
  
  <pre><code>import './question.dart';
  import 'package:shared_preferences/shared_preferences.dart';
  
   class Quiz { 
   List&lt;Question&gt; _questions;
  int _currentQuestionIndex = -1;
  int _score = 0;
  int _highscore;
  
    Future checkFirstSeen() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
      bool _seen = (prefs.getBool('seen') ?? false);
  
     if (_seen) {
    _highscore=_highscore;
     } else {
    prefs.setBool('seen', true);
    _highscore=0;
      }
  }
  
   Quiz(this._questions) {
      _questions.shuffle();
    }
  
     List&lt;Question&gt; get questions =&gt; _questions;
    int get length =&gt; _questions.length;
    int get questionNumber =&gt; _currentQuestionIndex+1;
    int get score =&gt; _score;
    int get highscore =&gt; _highscore;
  
   Question get nextQuestion {
    _currentQuestionIndex++;
    if (_currentQuestionIndex &gt;= length) return null;
    return _questions[_currentQuestionIndex];
    }
  
   void answer(bool isCorrect) {
    if (isCorrect) _score++;
   }
  
   //added fun for highscore
   void check() {  
   if (_score &gt; _highscore) {
      _highscore = _score;
   } else {
    _highscore = _highscore;
   }
   }
  
   }
  </code></pre>
  
  <p>this returns me always score and high score as same value(number).tell me solution</p>