flutter_bloc_infinite_list
A sample application to learn flutter bloc the correct way. Took some deviations from the tutorial and based on the experiance here are some notes to self:
-
You can do many things with Cubit and don’t need Bloc all the time. In this example, there are transformation using events, debounce etc… Therefore, Blocs is really needed here.
-
Using enumeration for the loading status is better than writing specific classes for each state as it increases boilerplate code.
-
I love bloc! ❤️
Getting Started
This application is inspired from the bloc tutorial.
Project Structure
Follows a feature-driven directory structure.
Refer the project structure directly from the tutorial from here.
├── lib | ├── posts │ │ ├── bloc │ │ │ └── post_bloc.dart | | | └── post_event.dart | | | └── post_state.dart | | └── models | | | └── models.dart* | | | └── post.dart │ │ └── view │ │ | ├── posts_page.dart │ │ | └── posts_list.dart | | | └── view.dart* | | └── widgets | | | └── bottom_loader.dart | | | └── post_list_item.dart | | | └── widgets.dart* │ │ ├── posts.dart* │ ├── app.dart │ ├── simple_bloc_observer.dart │ └── main.dart ├── pubspec.lock ├── pubspec.yaml