Select Git revision
fetch_data_helper.dart
-
Benoît Harrault authoredBenoît Harrault authored
data.dart 1.17 KiB
import 'package:flutter/foundation.dart';
class Data extends ChangeNotifier {
// randomization
String _word = '';
List _otherWords = [];
List _images = [];
// game data
int _questionsCount = 0;
int _goodAnswers = 0;
int _wrongAnswers = 0;
String get word => _word;
set updateWord(String value) {
_word = value;
notifyListeners();
}
List get otherWords => _otherWords;
set updateOtherWords(List words) {
_otherWords = words;
notifyListeners();
}
List get images => _images;
set updateImages(List images) {
_images = images;
notifyListeners();
}
void resetGame() {
_word = '';
_otherWords = [];
_images = [];
_questionsCount = 0;
_goodAnswers = 0;
_wrongAnswers = 0;
notifyListeners();
}
int get questionsCount => _questionsCount;
set updateQuestionsCount(int value) {
_questionsCount = value;
notifyListeners();
}
int get goodAnswers => _goodAnswers;
set updateGoodAnswers(int value) {
_goodAnswers = value;
notifyListeners();
}
int get wrongAnswers => _wrongAnswers;
set updateWrongAnswers(int value) {
_wrongAnswers = value;
notifyListeners();
}
}