df_collection 0.8.2 copy "df_collection: ^0.8.2" to clipboard
df_collection: ^0.8.2 copied to clipboard

A package designed to extend Dart collections by offering additional functionality.

example/example.dart

//.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
  }
}
1
likes
160
pub points
66%
popularity

Publisher

verified publisherdevcetra.com

A package designed to extend Dart collections by offering additional functionality.

Repository (GitHub)
View/report issues

Topics

#collection #json #list #map #utils

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

collection, df_type

More

Packages that depend on df_collection