The HomePage screen will read data from the BLoC and show a ListView containing the Todo objects to the user. From this screen, the user will also write to the BLoC by deleting an object when they swipe an element from the ListView:
- In the main.dart file, edit the imports so that they contain a reference to the todo_bloc.dart file and a file that we will add shortly called todo_screen.dart. Remove all other imports:
import 'package:flutter/material.dart';import 'todo_screen.dart';import 'data/todo.dart';import 'bloc/todo_bloc.dart';
- At the beginning of the _HomePageState class, create a field for the TodoBloc and one for the List of Todo that will be shown on the screen, and remove the preexisting code: ...