sortLogsMapByTime method

LinkedHashMap<String, HttpBean> sortLogsMapByTime(
  1. LinkedHashMap<String, HttpBean> logs
)

Implementation

LinkedHashMap<String, HttpBean> sortLogsMapByTime(
  LinkedHashMap<String, HttpBean> logs,
) {
  return LinkedHashMap.fromEntries(
    logs.entries.toList()..sort((a, b) {
      final aDate = a.value.request?.requestTime;
      final bDate = b.value.request?.requestTime;

      if (aDate != null && bDate != null) {
        return aDate.compareTo(bDate);
      }

      return 0;
    }),
  );
}