ignored_file.dart 761 B

12345678910111213141516171819202122232425262728293031
  1. import 'package:photos/models/trash_file.dart';
  2. const kIgnoreReasonTrash = "trash";
  3. class IgnoredFile {
  4. final String? localID;
  5. final String? title;
  6. final String? deviceFolder;
  7. String reason;
  8. IgnoredFile(this.localID, this.title, this.deviceFolder, this.reason);
  9. static fromTrashItem(TrashFile? trashFile) {
  10. if (trashFile == null) return null;
  11. if (trashFile.localID == null ||
  12. trashFile.localID!.isEmpty ||
  13. trashFile.title == null ||
  14. trashFile.title!.isEmpty ||
  15. trashFile.deviceFolder == null ||
  16. trashFile.deviceFolder!.isEmpty) {
  17. return null;
  18. }
  19. return IgnoredFile(
  20. trashFile.localID,
  21. trashFile.title,
  22. trashFile.deviceFolder,
  23. kIgnoreReasonTrash,
  24. );
  25. }
  26. }