endTest method

void endTest()

Implementation

void endTest() {
  test!.live = false;
  countdownTimer?.cancel();
  _updateTimer?.cancel();
  setState(() {
    isTestRunning = false;
    hasTestStarted = false;
    test!.averageFHR = interpretations?.basalHeartRate;
    _endTime = DateTime.now();
  });

  int actualDuration = getActualDurationInSeconds();
  test!.lengthOfTest = actualDuration;
  test!.printDetails();

  if (route == AppConstants.instantTest) {
    context.pushReplacement(
      AppRoutes.registerMother,
      extra: {'test': test, 'route': route},
    );
  } else {
    saveTest();
  }
}