Skip to content

Commit

Permalink
chore(flutter_todos): remove unused TodosOverviewTodoSaved (#3265)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-jewell authored Mar 9, 2022
1 parent 330d43b commit fa22958
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 47 deletions.
1 change: 0 additions & 1 deletion docs/fluttertodostutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ Let's create `todos_overview/bloc/todos_overview_event.dart` and define the even
[todos_overview_event.dart](https://raw.githubusercontent.com/felangel/bloc/master/examples/flutter_todos/lib/todos_overview/bloc/todos_overview_event.dart ':include')

- `TodosOverviewSubscriptionRequested`: This is the startup event. In response, the bloc subscribes to the stream of todos from the `TodosRepository`.
- `TodosOverviewTodoSaved`: This saves a todo.
- `TodosOverviewTodoDeleted`: This deletes a Todo.
- `TodosOverviewTodoCompletionToggled`: This toggles a todo's completed status.
- `TodosOverviewToggleAllRequested`: This toggles completion for all todos.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class TodosOverviewBloc extends Bloc<TodosOverviewEvent, TodosOverviewState> {
}) : _todosRepository = todosRepository,
super(const TodosOverviewState()) {
on<TodosOverviewSubscriptionRequested>(_onSubscriptionRequested);
on<TodosOverviewTodoSaved>(_onTodoSaved);
on<TodosOverviewTodoCompletionToggled>(_onTodoCompletionToggled);
on<TodosOverviewTodoDeleted>(_onTodoDeleted);
on<TodosOverviewUndoDeletionRequested>(_onUndoDeletionRequested);
Expand Down Expand Up @@ -41,13 +40,6 @@ class TodosOverviewBloc extends Bloc<TodosOverviewEvent, TodosOverviewState> {
);
}

Future<void> _onTodoSaved(
TodosOverviewTodoSaved event,
Emitter<TodosOverviewState> emit,
) async {
await _todosRepository.saveTodo(event.todo);
}

Future<void> _onTodoCompletionToggled(
TodosOverviewTodoCompletionToggled event,
Emitter<TodosOverviewState> emit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ class TodosOverviewSubscriptionRequested extends TodosOverviewEvent {
const TodosOverviewSubscriptionRequested();
}

class TodosOverviewTodoSaved extends TodosOverviewEvent {
const TodosOverviewTodoSaved(this.todo);

final Todo todo;

@override
List<Object> get props => [todo];
}

class TodosOverviewTodoCompletionToggled extends TodosOverviewEvent {
const TodosOverviewTodoCompletionToggled({
required this.todo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ void main() {
);
});

group('TodosOverviewTodoSaved', () {
blocTest<TodosOverviewBloc, TodosOverviewState>(
'saves todo using repository',
build: buildBloc,
act: (bloc) => bloc.add(TodosOverviewTodoSaved(mockTodos.first)),
verify: (_) {
verify(() => todosRepository.saveTodo(mockTodos.first)).called(1);
},
);
});

group('TodosOverviewTodoCompletionToggled', () {
blocTest<TodosOverviewBloc, TodosOverviewState>(
'saves todo with isCompleted set to event isCompleted flag',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ void main() {
});
});

group('TodosOverviewTodoSaved', () {
test('supports value equality', () {
expect(
TodosOverviewTodoSaved(mockTodo),
equals(TodosOverviewTodoSaved(mockTodo)),
);
});

test('props are correct', () {
expect(
TodosOverviewTodoSaved(mockTodo).props,
equals(<Object?>[
mockTodo, // todo
]),
);
});
});

group('TodosOverviewTodoCompletionToggled', () {
test('supports value equality', () {
expect(
Expand Down

0 comments on commit fa22958

Please sign in to comment.