writeLeaderboardRecord method

  1. @override
Future<LeaderboardRecord> writeLeaderboardRecord({
  1. required Session session,
  2. required String leaderboardId,
  3. int? score,
  4. int? subscore,
  5. String? metadata,
})
override

Implementation

@override
Future<LeaderboardRecord> writeLeaderboardRecord({
  required model.Session session,
  required String leaderboardId,
  int? score,
  int? subscore,
  String? metadata,
}) async {
  _session = session;

  final res = await _api.nakamaWriteLeaderboardRecord(
      leaderboardId: leaderboardId,
      body: WriteLeaderboardRecordRequestLeaderboardRecordWrite(
        score: score?.toString(),
        subscore: subscore?.toString(),
        metadata: metadata,
      ));

  return LeaderboardRecord()..mergeFromProto3Json(res.body!.toJson());
}