Building a package to manage lists with Flutter Bloc

Dana Hartweg
Flutter Community
Published in
10 min readJul 22, 2020

--

Goal

The app I’m working on in my spare time has a need to consume large lists of data, with a key requirement of making it easy to filter the list based on properties of items in the list. Additionally, the list should be searchable to further narrow the results.

There are several places I was going to need this functionality, so it needed to be as generic as possible. I’m making heavy use of the flutter_bloc package for state management, so it should ideally be able to slot right into the existing app architecture. Needing to be generic anyway, it seemed like a perfect opportunity to create a Flutter package that could be helpful to everyone!

To recap, our end goal is a package that meets the following criteria

  • Follows the flutter_bloc pattern
  • Accepts a data source
  • Exposes state derived from specified properties of the data source items that can be used to render UI that manages the available filter options
  • Is able to filter that data source by user-activated options
  • Is able to narrow that data source by searching provided properties
  • Exposes state that can be used to render a list
  • Is as generic as possible

--

--