diff --git a/lib/services/category_service.dart b/lib/services/category_service.dart index d271da9..ea1f2e2 100644 --- a/lib/services/category_service.dart +++ b/lib/services/category_service.dart @@ -46,11 +46,7 @@ class CategoryService { }) async { return ApiClient.instance.patch, Category>( '/houses/$houseId/categories/$categoryId', - body: { - if (name != null) 'name': name, - if (icon != null) 'icon': icon, - if (color != null) 'color': color, - }, + body: {'name': ?name, 'icon': ?icon, 'color': ?color}, fromJson: (data) => Category.fromJson(data), ); } diff --git a/lib/services/checklist_service.dart b/lib/services/checklist_service.dart index 37bfb4d..6d5285a 100644 --- a/lib/services/checklist_service.dart +++ b/lib/services/checklist_service.dart @@ -143,9 +143,9 @@ class ChecklistService { if (description != null && description.isNotEmpty) 'description': description, if (quantity != null && quantity.isNotEmpty) 'quantity': quantity, - if (categoryId != null) 'categoryId': categoryId, + 'categoryId': ?categoryId, if (rrule != null && rrule.isNotEmpty) 'rrule': rrule, - if (deleteOnDone != null) 'deleteOnDone': deleteOnDone, + 'deleteOnDone': ?deleteOnDone, }, fromJson: (data) => ListItem.fromJson(data), ); @@ -167,15 +167,14 @@ class ChecklistService { return ApiClient.instance.patch, ListItem>( '/houses/$houseId/lists/$listId/items/$itemId', body: { - if (name != null) 'name': name, - if (description != null) 'description': description, - if (quantity != null) 'quantity': quantity, + 'name': ?name, + 'description': ?description, + 'quantity': ?quantity, if (clearCategory) 'categoryId': 0, if (!clearCategory && categoryId != null) 'categoryId': categoryId, - if (rrule != null) 'rrule': rrule, - if (repeatFromCompletion != null) - 'repeatFromCompletion': repeatFromCompletion, - if (deleteOnDone != null) 'deleteOnDone': deleteOnDone, + 'rrule': ?rrule, + 'repeatFromCompletion': ?repeatFromCompletion, + 'deleteOnDone': ?deleteOnDone, }, fromJson: (data) => ListItem.fromJson(data), ); diff --git a/lib/services/note_service.dart b/lib/services/note_service.dart index d11c0ce..73dddce 100644 --- a/lib/services/note_service.dart +++ b/lib/services/note_service.dart @@ -51,11 +51,7 @@ class NoteService { }) async { return ApiClient.instance.post, Note>( '/houses/$houseId/notes', - body: { - 'title': title, - if (content != null) 'content': content, - if (color != null) 'color': color, - }, + body: {'title': title, 'content': ?content, 'color': ?color}, fromJson: (data) => Note.fromJson(data), ); } @@ -69,11 +65,7 @@ class NoteService { }) async { return ApiClient.instance.patch, Note>( '/houses/$houseId/notes/$noteId', - body: { - if (title != null) 'title': title, - if (content != null) 'content': content, - if (color != null) 'color': color, - }, + body: {'title': ?title, 'content': ?content, 'color': ?color}, fromJson: (data) => Note.fromJson(data), ); } diff --git a/lib/services/photo_service.dart b/lib/services/photo_service.dart index a783ba0..4606f0b 100644 --- a/lib/services/photo_service.dart +++ b/lib/services/photo_service.dart @@ -91,7 +91,7 @@ class PhotoService { return ApiClient.instance.patch, Photo>( '/houses/$houseId/photos/$photoId', body: { - if (caption != null) 'caption': caption, + 'caption': ?caption, if (moveToRoot) 'folderId': 0, if (!moveToRoot && folderId != null) 'folderId': folderId, }, @@ -155,7 +155,7 @@ class PhotoService { }) async { return ApiClient.instance.patch, PhotoFolder>( '/houses/$houseId/photos/folders/$folderId', - body: {if (name != null) 'name': name}, + body: {'name': ?name}, fromJson: (data) => PhotoFolder.fromJson(data), ); } @@ -203,10 +203,7 @@ class PhotoService { }) async { await ApiClient.instance.put, void>( '/houses/$houseId/prefs', - body: { - if (photoSort != null) 'photoSort': photoSort, - if (photoFoldersFirst != null) 'photoFoldersFirst': photoFoldersFirst, - }, + body: {'photoSort': ?photoSort, 'photoFoldersFirst': ?photoFoldersFirst}, fromJson: (_) {}, ); } diff --git a/tool/fix_i18n_escapes.dart b/tool/fix_i18n_escapes.dart index 994bbd4..f40977c 100644 --- a/tool/fix_i18n_escapes.dart +++ b/tool/fix_i18n_escapes.dart @@ -1,3 +1,5 @@ +// ignore_for_file: avoid_print + import 'dart:io'; /// Replaces YAML unicode escape sequences (\uXXXX, \xXX) with actual UTF-8