1. Section Intro


If you have any list with more than a dozen items to show, search makes it easier for users to find what they're looking for.

When implementing search, there are many requirements to consider:

  1. Should search be implemented client-side or server-side?
  2. Should we debounce the keyboard input events and implement rate limiting on the client so that we don't make too many network requests?
  3. Should we support pagination?
  4. Should our search algorithm be fuzzy and take into account spelling mistakes?
  5. Where should it search from? A single property, multiple properties from a single table, or the entire database (full-text search)?
  6. How big is the search database? And is it centralized or distributed?
  7. Should we cancel requests if the search query changes before we get a response from the previous one?
  8. Should we cache previously saved search results?
  9. Should we sort search results based on one or more criteria?
  10. Do we want to see search suggestions as we type so that we can more easily complete our query?

Search in the eCommerce app

The goal of this section is to implement a basic product search feature, so that we can type the name of a product and get a list of matching results.

As we will see, Riverpod gives us all the APIs that we need to implement search efficiently.

For now, we'll implement client-side search by using the FakeProductsRepository as the database that contains all the products,

And in the next course about Flutter & Firebase, we will explore two solutions to implement server-side search:

  • using Cloud Firestore, which has some limitations
  • using Algolia, which is a paid service that gives us more powerful search capabilities.

Complete and Continue