symmetric_difference 2.0.1 copy "symmetric_difference: ^2.0.1" to clipboard
symmetric_difference: ^2.0.1 copied to clipboard

This Dart package provides efficient set operations (union, intersection, difference) for multiple collections, replacing manual methods with a single, robust solution.

example/symmetric_difference_example.dart

import 'package:symmetric_difference/symmetric_difference.dart';

void main() {
  Set set1 = {1, 3, 4, ""};
  Set set2 = {2, 3, "e"};
  Set set3 = {2, 3, "e"};

  // 1. search for unique items // {1, 4}
  print(SymmetricSet.multiSymmetricDifference([set1, set2, set3]));

  // 2. search for dublicate items in all sets  {3}
  print(
    SymmetricSet.multiSymmetricDifference([
      set1,
      set1,
      set3,
    ], intersection: true),
  );

  // 3. search for items that are repeated at 2 times in all    {2, e}
  // when setting 1, we will get unique elements, as in the case of not using the intersection parameters.

  print(
    SymmetricSet.multiSymmetricDifference(
      [set1, set2, set3],
      intersection: true,
      intersectionElem: 2,
    ),
  );

  // 4. look for elements that are repeated at least 2 or more times.   {3, 2, e}
  // when setting 1, we will get unique elements, as in the case of not using the intersection parameters.
  print(
    SymmetricSet.multiSymmetricDifference(
      [set1, set2, set3],
      intersection: true,
      intersectionElem: 2,
      intersectionElemMinMax: "max",
    ),
  );
}
0
likes
0
points
331
downloads

Publisher

unverified uploader

Weekly Downloads

This Dart package provides efficient set operations (union, intersection, difference) for multiple collections, replacing manual methods with a single, robust solution.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on symmetric_difference