Flutter Firebase Get or Search Data Containing String

Viewed 25

I looked in many places, but I couldn't find a correct and precise solution, so I'm asking again. I have an application and this application has a search query that works like this under normal conditions.

ds = await _firestore
        .collectionGroup("Cars")
        .where("name", isEqualTo: widget.name).get();

In this usage, I can get car names that match exactly what I type of widget.name.

But I want to run a query like this. For example, there are car names in this style in my database: Mercedes Sport, Bmw Sport, Audi Sport, Porsche. When I type Sport in the search field, I want to get Mercedes Sport, Bmw Sport and Audi Sport data. Or when I type orsch I want to get Porsche data or when I type Mer I want to get Mercedes Sport data. In other words, I want to display the string data containing the string that I entered briefly in the search section and searched.

I need a proper solution that will correctly meet all of the requirements I have described.

0 Answers
Related