ScoutingSessionBloc constructor

ScoutingSessionBloc()

Implementation

ScoutingSessionBloc()
    : prelim = PrelimInfo.optional(),
      auto = AutoInfo.optional(),
      teleop = TeleOpInfo.optional(),
      endgame = EndgameInfo.optional(),
      comments = CommentsInfo.optional(
          associatedId: "000", matchNumber: 0, teamNumber: 0),
      misc = MiscInfo.optional(),
      super(PrelimState(PrelimInfo.optional())) {
  id = const Uuid()
      .v1(); // generate UUID using v1 which is time based
  comments.associatedId = id;
  on<PrelimUpdateEvent>((PrelimUpdateEvent event,
      Emitter<ScoutingSessionStates> emit) {
    emit(PrelimState(prelim));
    Debug().info(
        "[Update] SCOUTING_SESSION$hashCode PRELIM->updated.");
  });
  on<AutoUpdateEvent>(
      (AutoUpdateEvent event, Emitter<ScoutingSessionStates> emit) {
    emit(AutoState(auto));
    Debug()
        .info("[Update] SCOUTING_SESSION$hashCode AUTO->updated");
  });
  on<MiscUpdateEvent>(
      (MiscUpdateEvent event, Emitter<ScoutingSessionStates> emit) {
    emit(MiscState(misc));
    Debug()
        .info("[Update] SCOUTING_SESSION$hashCode MISC->updated");
  });
  on<TeleOpUpdateEvent>((TeleOpUpdateEvent event,
      Emitter<ScoutingSessionStates> emit) {
    emit(TeleOpState(teleop));
    Debug()
        .info("[Update] SCOUTING_SESSION$hashCode TELEOP->updated");
  });
  on<EndgameUpdateEvent>((EndgameUpdateEvent event,
      Emitter<ScoutingSessionStates> emit) {
    emit(EndgameState(endgame));
    Debug().info(
        "[Update] SCOUTING_SESSION$hashCode ENDGAME->updated");
  });
  on<CommentsUpdateEvent>((CommentsUpdateEvent event,
      Emitter<ScoutingSessionStates> emit) {
    emit(CommentsState(comments));
    Debug().info(
        "[Update] SCOUTING_SESSION$hashCode COMMENTS#${comments.associatedId}->updated");
  });
}