How do I get the first character of a string in dart flutter.
For example,a string having a value "Hello World" should return only "H". I am fetching data from my firestore database. My code is:
searchByName(String searchField) {
return Firestore.instance
.collection('posts')
.where('description',
isEqualTo: searchField.substring(0, 1).toUpperCase())
.getDocuments();
}
I want to get the first letter from the data that I recieve from 'description' field in above code.