You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
refactor(mobile): Use switch
expression when possible (#15852)
refactor: Use `switch` expression when possible Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@ -14,13 +14,11 @@ class BackupRepository extends DatabaseRepository implements IBackupRepository {
|
||||
@override
|
||||
Future<List<BackupAlbum>> getAll({BackupAlbumSort? sort}) {
|
||||
final baseQuery = db.backupAlbums.where();
|
||||
final QueryBuilder<BackupAlbum, BackupAlbum, QAfterSortBy> query;
|
||||
switch (sort) {
|
||||
case null:
|
||||
query = baseQuery.noOp();
|
||||
case BackupAlbumSort.id:
|
||||
query = baseQuery.sortById();
|
||||
}
|
||||
final QueryBuilder<BackupAlbum, BackupAlbum, QAfterSortBy> query =
|
||||
switch (sort) {
|
||||
null => baseQuery.noOp(),
|
||||
BackupAlbumSort.id => baseQuery.sortById(),
|
||||
};
|
||||
return query.findAll();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user