Flutter Searching With Firebase Firestore | ListView Search | Filter Data

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
create a search bar and learn how to search add Firebase core and firestore dependencies include both packages then initialize Firebase in void Main use this client collections data name email mobile are fields the name field is what we are searching for using stateful widget five datas now all data can be displayed without searching create a list variable list all results create a function for populating data in that list variable get client stream async VAR data equals await Firebase firestore.instance.collection client order by name dot get add data to variable set state add results equals data.docs then call this function in init state init state function client stream then create a body and scaffold app bar search box can be created later inside the app bar body display the data using the listview.builder item counts all results.length item Builder function parameters context index return list tile title text widget display name field all results of index name subtitle email trailing mobile then run the app data displayed then add a search bar inside the app bar title Cupertino search text field search bar displayed change the color background color White search using this create a text editing controller final text editing controller search controller equals text editing controller include controller in search text field create an ad listener in init state search controller.ad listener give a function name on search changed then create the function on search changed print search controller.txt run the app yes search text is displayed then dispose The Listener the get client stream function can be changed from init state create a did change dependencies and call that function then run it's working then create a function for search a create for search list result list then create a function search result list create a variable show result if search controller.text not equals null else if there is no text in search all data should be displayed show result equals list.form all results check all the data using foreign Loop for client snapshot in all results VAR name equals client snapshot of name.tostring.to lowercase then check if name dot contains search controller.text.to lowercase add data to show result variable show result.add client snapshot then set state result list equals show results call this function in on search changed then call it in get client stream function then change the variable name to result list in inside the list view Builder then run the app client name second okay it's working
Info
Channel: True Coders
Views: 9,799
Rating: undefined out of 5
Keywords: Implement searching with Firebase firestore, flutter search firebase, flutter firebase search query
Id: S-8v9nOCUfw
Channel Id: undefined
Length: 13min 34sec (814 seconds)
Published: Wed Feb 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.