Skip to content
pubscout

collection_ext

1.0.0, released 5 years ago by xinthink.com

A set of extension methods for Dart collections to write functional-programming-styled code.

WASM-ready
$ flutter pub add collection_ext
Source repository

What it does

Adds extension methods to Iterables, Maps, and Ranges to make working with Dart collections easier and more concise. Provides functional-programming-style helpers like forEachIndexed, mapIndexed, foldRight, and null-safe collection operations.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to write more concise, functional-style Dart collection code.
  • You need convenient extension methods for Iterables, Maps, and Ranges.

Skip it when

  • You prefer standard imperative loops over extension-based collection manipulation.

Strengths

  • Makes collection manipulation cleaner and more readable.
  • All extension methods of Iterables and Maps are null-safe.
  • Allows importing specific modules like iterables or maps individually.

Weaknesses

  • Limited to collection extension utilities.
  • Release history and detailed changelog entries are not documented directly in the changelog.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:collection_ext/all.dart';

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

Alternatives

Packages that do the same job and could replace collection_ext.

Works with

Packages commonly used together with collection_ext: ones it builds on, ones built on it, and its own family.