collection_ext 0.0.2+1 copy "collection_ext: ^0.0.2+1" to clipboard
collection_ext: ^0.0.2+1 copied to clipboard

outdated

Extension methods for Dart collections.

collection_ext #

Pub Check Status Code Coverage MIT

A set of extension methods for Dart collections, designed in the purpose of making it easier to write functional-style, concise dart codes.

Working on an Iterable for example, with collection_ext, we can write:

iterable.forEachIndexed((i, x) => /* use index i & element x */)

instead of:

var i = 0;
for (var x in iterable) {
  // use index i & element x
  i++;
}

Usage #

Import all extension functions at once:

import 'package:collection_ext/all.dart';

Column(
  children: getItems()
    .nonNull
    .mapIndexed((i, item) => Text("#$i ${item.title}"))
    .asList(),
)

Or you can import the needed module only, for example:

import 'package:collection_ext/iterables.dart';

final sum = [2, 4, 6].foldRight(0, (acc, x) => acc + x);

Available Modules #

👉 See API Docs for more details

I'm working on more useful extensions, PRs are welcome! 🍻🖖

17
likes
0
pub points
83%
popularity

Publisher

verified publisherxinthink.com

Extension methods for Dart collections.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

tuple

More

Packages that depend on collection_ext