record_iterable_utils 0.1.0 copy "record_iterable_utils: ^0.1.0" to clipboard
record_iterable_utils: ^0.1.0 copied to clipboard

A Dart package providing extension methods and utility functions for working with iterable records

record_iterable_utils #

A Dart package providing a collection of extension methods and utility functions for working with iterable records.

Features #

  • mapRecord: Apply a mapping function to each record in an iterable.
  • whereRecord: Filter records in an iterable based on a predicate function.

Installation #

Add the following to your pubspec.yaml file:

dependencies:
  record_iterable_utils: ^{latest}

Then run dart pub get to fetch the package.

Usage #

Import the package in your Dart code:

import 'package:record_iterable_utils/record_iterable_utils.dart';

Then use the extension methods on your record iterables:

final students = [('Alice', 20), ('Bob', 22), ('Charlie', 19), ('David', 21)];

// Map records to a string representation
final mappedStudents =
    students.mapRecord((name, age) => '$name is $age years old');
print(mappedStudents);
// Output: (Alice is 20 years old, Bob is 22 years old, Charlie is 19 years old, David is 21 years old)

// Filter records based on age
final filteredStudents = students.whereRecord((name, age) => age >= 21);
print(filteredStudents);
// Output: ((Bob, 22), (David, 21))
2
likes
150
points
115
downloads

Publisher

verified publisherk9i.app

Weekly Downloads

A Dart package providing extension methods and utility functions for working with iterable records

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on record_iterable_utils