We will cover briefly about

  1. Implement Search in Flutter Web

  2. Saving the user searches (Bonus)

  3. Displaying user search history (Bonus)

Implement Search in Flutter Web

Let’s start with the algorithm

We extracted out the algorithm(StringSearch) for searching and put inside a separate file called string_search.dart

StringSearch(this.input, this.searchTerm)
  • input: List<String>, e.g [‘Hey’, ‘there’]

  • searchTerm: String which the user searched. e.g here

Condition: Length of searchTerm should be more than 1 letter. e.g If user searches for h, we return empty.