Home > database >  The return type 'void' isn't a 'FutureOr<Iterable<_>>', as requ
The return type 'void' isn't a 'FutureOr<Iterable<_>>', as requ

Time:07-08

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'),

CodePudding user response:

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()
  • Related