calculateScore method

  1. @override
int calculateScore(
  1. dynamic result
)
override

The results is the list of pairs correcly placed in the test. The score is the sum of correctly placed pairs.

Implementation

@override
calculateScore(dynamic result) {
  var sum = 0;
  try {
    List<int> pairs = result['pairs'] as List<int>;
    for (int pair in pairs) {
      sum += pair;
    }
  } catch (error) {
    print('$runtimeType - Error calculating score: $error');
  }
  return sum;
}