Created
January 26, 2021 07:43
-
-
Save anoochit/2c5aa5525efb3545b4ae3afd82d769d9 to your computer and use it in GitHub Desktop.
simple search NOT recommended
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<List<String>> searchTrip(String keyword) async { | |
List<String> docId = []; | |
var value = await FirebaseFirestore.instance.collection('trips').get(); | |
value.docs.forEach((element) { | |
var title = element['name'].toString().toLowerCase(); | |
var body = element['body'].toString().toLowerCase(); | |
if (body.contains(keyword)) docId.add(element.id); | |
if (title.contains(keyword)) docId.add(element.id); | |
}); | |
return docId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment