getOldSyncedAppleHealthElements method

List<AppleHealthElement> getOldSyncedAppleHealthElements()

Implementation

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