The return type 'void' isn't a 'FutureOr<Iterable<_>>', as required by the closure's context

982 Views Asked by At

The below code is working fine. but I wanted to remove items using condition,

state.bank
      .where(
        (i) => i.name!.toLowerCase().contains(value.toLowerCase())).toList()

for remove items using condition, I've used removeWhere() once I added the condition, the error occurred.

state.bank
     .where(
      (i) => i.name!.toLowerCase().contains(value.toLowerCase()))
                  .toList().removeWhere((element) => element.code == '7788'),
1

There are 1 best solutions below

0
Kaushik Chandru On BEST ANSWER

You can add 2 conditions in the same place. Try the following

state.bank
      .where(
        (i) => i.name!.toLowerCase().contains(value.toLowerCase()) && i.code != '7788').toList()