init method Null safety

void init()

Implementation

void init() async {
  refreshControllerNew = RefreshController(initialRefresh: false);
  refreshControllerOld = RefreshController(initialRefresh: false);
  onTapTogglePinEventSub = EventService().eventBus.on<OnTapTogglePinEvent>().listen((e) async {
    final int foundIdx = reports!.indexWhere((element) => element == e.report);
    Report foundReport = reports![foundIdx];
    await ApiService().toggleReportPinned(foundReport);
    foundReport.isPinned = !foundReport.isPinned;
    reports![foundIdx] = foundReport;

    final String log = "${foundReport.reportTitle} " + "${foundReport.isPinned ? "핀 고정" : "핀 해제"}" + " 누름";
    LogManager().addLog(log, action: LogConstants.buttonTap, screen: runtimeType.toString());

    sortReportsByPinned();
    if (forceRender != null) forceRender!();
  });
  onTapHelpfulButtonEventSub = EventService().eventBus.on<OnTapFeedbackButtonEvent>().listen((OnTapFeedbackButtonEvent e) async {
    final int foundIdx = reports!.indexWhere((element) => element == e.report);
    Report foundReport = reports![foundIdx];
    foundReport.isPinned = false;
    foundReport.feedback = e.feedbackType;
    await ApiService().updateReportFeedback(foundReport);
    reports![foundIdx] = foundReport;
    final String log = "${foundReport.reportTitle} " + "${e.feedbackType.name}" + " 누름";
    LogManager().addLog(log, action: LogConstants.buttonTap, screen: runtimeType.toString());
    sortReportsByPinned();
    if (forceRender != null) forceRender!();
  });
}