In this post I’ll continue my previous one and go into Flutter Bloc Minimal List app/view. You could see the code here: https://github.com/tomavelev/dev_examples/tree/master/bloc/lib_bloc_minimal_list. There are not that many differences, but, here are the ones nonetheless:
Minimal List
What more minimal a list could be – a one located in the memory. I’ve stored it inside a variable of the Bloc Object. In common cases the data will be loaded incrementally by the backend or some local database. There could be even more performant implementation. I’ve seen such in Android Page Library. Instead of having an incrementally bigger list of records in memory – have in memory only the page that is displayed.
Flutter Bloc Paginated List
A key aspect of this minimal evolution of the example is – handling the Pagination with a wrapper partial data object. The Flutter rx Bloc family offer a plugin for this. I’ve used simple object like this in my own software. I’ve seen the need for this – time and time again in my career.
- Never load more than it’s required.
- Optimize handling big lists for performance in memory
One of the ways to archive better user experience is with Lazy loading items on scroll. I’ve written down an example in another article.
It is valid for:
- The Database Layer,
- Application Server Layer,
- Visual Interface.
Obviously – keeping a list in memory is not optimal, but for the sake of the example it will be there – inside the bloc.
