calculateScoreFlanker method
The result is the number of mistakes made during the test. If the number of mistakes > 2, the test is failed and a score of 0 is returned. Otherwise, a score of 1 is returned.
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');
}
return [sum, meanCongruent, meanIncongruent];
}