Skip to content

Commit 6e7a503

Browse files
committed
feat: added a new createdCategory property to the state. This will allow the CreateCategoryBloc to hold the newly created category object upon successful submission, which is the first step toward updating the main list locally instead of doing a full refresh.
1 parent a83e29b commit 6e7a503

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/content_management/bloc/create_category/create_category_state.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ final class CreateCategoryState extends Equatable {
2525
this.iconUrl = '',
2626
this.contentStatus = ContentStatus.active,
2727
this.errorMessage,
28+
this.createdCategory,
2829
});
2930

3031
final CreateCategoryStatus status;
@@ -33,6 +34,7 @@ final class CreateCategoryState extends Equatable {
3334
final String iconUrl;
3435
final ContentStatus contentStatus;
3536
final String? errorMessage;
37+
final Category? createdCategory;
3638

3739
/// Returns true if the form is valid and can be submitted.
3840
/// Based on the Category model, only the name is required.
@@ -45,6 +47,7 @@ final class CreateCategoryState extends Equatable {
4547
String? iconUrl,
4648
ContentStatus? contentStatus,
4749
String? errorMessage,
50+
Category? createdCategory,
4851
}) {
4952
return CreateCategoryState(
5053
status: status ?? this.status,
@@ -53,6 +56,7 @@ final class CreateCategoryState extends Equatable {
5356
iconUrl: iconUrl ?? this.iconUrl,
5457
contentStatus: contentStatus ?? this.contentStatus,
5558
errorMessage: errorMessage,
59+
createdCategory: createdCategory ?? this.createdCategory,
5660
);
5761
}
5862

@@ -64,5 +68,6 @@ final class CreateCategoryState extends Equatable {
6468
iconUrl,
6569
contentStatus,
6670
errorMessage,
71+
createdCategory,
6772
];
6873
}

0 commit comments

Comments
 (0)