flutterlistdarttypeahead

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


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

Solution

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