getScores static method

List<Scorecard> getScores(
  1. GameRef g
)

Get the score cards for the completed games

Implementation

static List<Scorecard> getScores(GameRef g) {
  List<Scorecard> scores = [];
  ffi.Pointer<lib.Scorecard> data = _core.get_scores(g);
  for (var i = 0; i < SCORE_SIZE; i++) {
    scores.add(
      Scorecard.fromAddress(data.address + (i * ffi.sizeOf<lib.Scorecard>())),
    );
  }
  malloc.free(data);
  return scores;
}