sort method

  1. @override
void sort(
  1. List<PathWrapper<AssetPathEntity>> list
)
override

Implementation

@override
void sort(List<PathWrapper<AssetPathEntity>> list) {
  if (list.any(
    (PathWrapper<AssetPathEntity> e) => e.path.lastModified != null,
  )) {
    list.sort(
      (PathWrapper<AssetPathEntity> a, PathWrapper<AssetPathEntity> b) {
        if (a.path.lastModified == null || b.path.lastModified == null) {
          return 0;
        }
        if (b.path.lastModified!.isAfter(a.path.lastModified!)) {
          return 1;
        }
        return -1;
      },
    );
  }
  list.sort(
    (PathWrapper<AssetPathEntity> a, PathWrapper<AssetPathEntity> b) {
      if (a.path.isAll) {
        return -1;
      }
      if (b.path.isAll) {
        return 1;
      }
      if (_isCamera(a.path)) {
        return -1;
      }
      if (_isCamera(b.path)) {
        return 1;
      }
      if (_isScreenShot(a.path)) {
        return -1;
      }
      if (_isScreenShot(b.path)) {
        return 1;
      }
      return 0;
    },
  );
}