calculateScoreFlanker method

List calculateScoreFlanker(
  1. dynamic result
)

Calculate scores - sum, mean congruent, mean incongruent

Implementation

List<dynamic> calculateScoreFlanker(dynamic result) {
  var accuracy = result['correct'] / (result['correct'] + result['mistakes']);

  var conSum = result['congruentTimes'].fold(0, (p, c) => p + c);
  var meanCongruent = conSum / result['congruentTimes'].length;

  var inconSum = result['incongruentTimes'].fold(0, (p, c) => p + c);
  var meanIncongruent = inconSum / result['incongruentTimes'].length;

  int sum = 0;
  try {
    if ((meanIncongruent - meanCongruent) as double < 500) sum = 1;
    if (accuracy as double < 0.73) sum = 0;
  } catch (error) {
    print('$runtimeType - Error calculating score: $error');
  }

  return [sum, meanCongruent, meanIncongruent];
}