sort method

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

Implementation

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