rewardsFailed static method

GameRewardsFailedEvent rewardsFailed({
  1. required GameHealthContext health,
  2. required String op,
  3. required GameOutcomeFailure failure,
  4. int? status,
  5. int durationMs = 0,
  6. bool timedOut = false,
})

Builds the rewards-failed health event. op is rewards for the page/widget fetch, state for the after-close entry check, or the bridge http path that failed. A timeout stays timeout.

Implementation

static GameRewardsFailedEvent rewardsFailed({
  required GameHealthContext health,
  required String op,
  required GameOutcomeFailure failure,
  int? status,
  int durationMs = 0,
  bool timedOut = false,
}) =>
    GameRewardsFailedEvent(
      health,
      op,
      timedOut
          ? 'timeout'
          : switch (failure) {
              GameOutcomeFailure.transport => 'network',
              GameOutcomeFailure.httpStatus => 'status',
              GameOutcomeFailure.invalidResponse => 'invalid_response',
            },
      status,
      durationMs,
    );