df_collection 0.8.0 df_collection: ^0.8.0 copied to clipboard
A package designed to extend Dart collections by offering additional functionality.
//.title
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
//
// Dart/Flutter (DF) Packages by DevCetra.com & contributors. The use of this
// source code is governed by an MIT-style license described in the LICENSE
// file located in this project's root directory.
//
// See: https://opensource.org/license/mit
//
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
//.title~
import 'package:df_collection/df_collection.dart';
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
void main() {
// Create a powerset from a list of sets.
{
final items = [
{1, 2},
{3, 4, 5},
];
final batches = items.powerset((a, b) => a + b);
print(batches); // [4, 5, 6, 5, 6, 7]
}
// Split a list into chunks of a maximum size.
{
final items = [1, 2, 3, 4, 5, 6, 7, 8, 9];
final batches = items.chunked(4);
print(batches); // ([1, 2, 3, 4], [5, 6, 7, 8], [9])
}
// Traverse a map using a list of keys and a set a new value.
{
var buffer = <dynamic, dynamic>{};
buffer.traverse([1, 2, 3, 4], newValue: 5);
print(buffer); // {1: {2: {3: {4: 5}}}}
print(buffer.traverse([1, 2, 3, 4])); // 5
}
}