Reputation: 174
Here is method in dart with books as a List need to check based on boolean value if its recomended assign that books to recommended[i] list. Need to make correct logic for it in dart. Please help THank you.
void recommendedBooksLists(RxList<dynamic> books) {
if (books.recommended==true){
// if books are recommended assign those books something like recommeded.assign(book)
}
Upvotes: 0
Views: 34
Reputation: 4767
you have to loop through the values of the books and push the book which is recommended as example
void recommendedBooksLists(RxList<dynamic> books) {
recommended = [];
for(var book in books.value){
if(book['recommended'] as bool == true){
recommended.add(book);
}
}
}
Upvotes: 2