Skip to content

Commit 53ebeb8

Browse files
committed
feat: updated the _onSubmitted method in create_category_bloc.dart. When a category is successfully created, I'll emit the new Category object along with the success status. This makes the newly created item available in the BLoC's state, which is essential for the UI to perform a local update on the main content list later.
1 parent 6e7a503 commit 53ebeb8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/content_management/bloc/create_category/create_category_bloc.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ class CreateCategoryBloc
9090
);
9191

9292
await _categoriesRepository.create(item: newCategory);
93-
emit(state.copyWith(status: CreateCategoryStatus.success));
93+
emit(
94+
state.copyWith(
95+
status: CreateCategoryStatus.success,
96+
createdCategory: newCategory,
97+
),
98+
);
9499
} on HtHttpException catch (e) {
95100
emit(
96101
state.copyWith(

0 commit comments

Comments
 (0)