getOldSyncedGoogleHealthConnectElements method

List<GoogleHealthConnectElement> getOldSyncedGoogleHealthConnectElements()

Implementation

List<GoogleHealthConnectElement> getOldSyncedGoogleHealthConnectElements() {
  final todayMinusSevenDays =
      DateTime.now().subtract(const Duration(days: 30));
  return googleHealthConnectElementBox!.values.where((element) {
    final date = DateTime.tryParse(element.syncedDate ?? '');
    if (date == null) return true;
    return (element.synced ?? false) && date.isBefore(todayMinusSevenDays);
  }).toList();
}