Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.34 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.34 KB

A library that provides methods to filter lists, sets, and maps asynchronously.

Getting started

Add the package to your pubspec.yaml file:

dependencies:
  async_filter: ^1.0.0

Afterward, import the package:

import 'package:async_filter/async_filter.dart';

Usage

This package provides an asyncFilter method for lists, sets, and maps. The method takes a predicate function that returns a Future<bool> and filters the collection asynchronously.

The predicate is executed for all elements in parallel.

Example:

final numbers = <int>[1, 2, 3, 5, 6, 7];
var result = await numbers.asyncFilter((x) async => x < 5); // (1, 2, 3)
result = await numbers.asyncFilter((x) async => x > 5); // (6, 7)
result = await numbers.asyncFilter((x) async => x.isEven); // (2, 6)