upload_strategy.dart 665 B

123456789101112131415161718192021222324252627282930
  1. enum UploadStrategy {
  2. // uploader will only try to upload the file in a collection if the file is
  3. // not already uploaded
  4. ifMissing,
  5. // alwaysUpload will always try to upload or add the file to given collection
  6. always,
  7. other,
  8. }
  9. int getInt(UploadStrategy uploadType) {
  10. switch (uploadType) {
  11. case UploadStrategy.ifMissing:
  12. return 0;
  13. case UploadStrategy.always:
  14. return 1;
  15. default:
  16. return -1;
  17. }
  18. }
  19. UploadStrategy getUploadType(int uploadType) {
  20. switch (uploadType) {
  21. case 0:
  22. return UploadStrategy.ifMissing;
  23. case 1:
  24. return UploadStrategy.always;
  25. default:
  26. return UploadStrategy.other;
  27. }
  28. }