Firestore doesn't support text-search by default. However, there are a few workarounds.
When you register a new user to your app you can store their username in firestore as an array that includes the possible ways you would search for a user (look at the attached image).

You can do that by splitting the name string.
setSearchParameters(String name) {
List<String> searchOptions = [];
String temp = "";
for (int i = 0; i < name.length; i++) {
temp = temp + name[i];
searchOptions.add(temp);
}
return searchOptions;
}
Then you can query the users collection by searching in that array using arrayContains
like this:
await usersCollection
.where('searchOptions', arrayContains: searchText)
.get()
.then((value) =>
value.docs.map((doc) => User.fromSnapShot(doc)).toList());
This solution works for simple cases but if you need advanced search capabilities then you'll have to use a 3rd party service such as Agolia.