startTest method

void startTest()

Implementation

void startTest() async {
  startTimer();
  await Future<dynamic>.delayed(const Duration(seconds: 1));
  Timer(Duration(seconds: widget.activity.lengthOfTest), () {
    if (mounted) {
      widget.eventLogger.testEnded();
      var flankerScoreResults = widget.activity.calculateScoreFlanker({
        'mistakes': wrongSwipe,
        'correct': rightSwipe,
        'congruentTimes': congruentTimes,
        'incongruentTimes': incongruentTimes
      });
      var flankerResult = RPFlankerResult.fromResults(
        wrongSwipe,
        rightSwipe,
        seconds,
        flankerScoreResults[0] as int,
        flankerScoreResults[1] as double,
        flankerScoreResults[2] as double,
        congruentTimes.length,
        incongruentTimes.length,
      );
      testTimer?.cancel();
      flankerTimer?.cancel();
      seconds = 0;
      widget.onResultChange(flankerResult.results);
      if (widget.activity.includeResults) {
        widget.eventLogger.resultsShown();
      }
      setState(() => activityStatus = ActivityStatus.Result);
    }
  });
}