Reputation: 1
in my quiz application i created a timer function which is given bellow ,
// function for handling Timer
Future<void> examProgress() async {
if (quizList.isNotEmpty) {
if (_timer != null) {
_timer?.cancel();
}
_timer = Timer.periodic(
const Duration(milliseconds: 1),
(Timer timer) async {
if (progress.value >= 1 && !stop.value) {
timer.cancel();
isCorrectAnswer(false);
isSkipped(false);
if (!isTap.value) {
(question?.isHintUsed ?? false) ? question?.point -= 5 : null;
question?.errorCount++;
question?.point -= 5;
isSkipped(true);
if (question?.errorCount == 3) {
_isCompleted++;
debugPrint("iscompleted ${_isCompleted.toString()}");
}
}
await setDelay();
} else if (stop.value) {
timer.cancel();
progress.value = 0;
} else {
progress.value = progress.value + (0.00015);
}
},
);
} else {
Get.back();
debugPrint("quiz_list_is_API_broke");
}
}
the questions changes with respect to the timer. it's not working in samsung s22 ultra. and works perfectly in all other devices and even in s23 ultra. can anyone suggest a possible chance for this issue ?
Upvotes: 0
Views: 161