enum_option_set 1.0.0 copy "enum_option_set: ^1.0.0" to clipboard
enum_option_set: ^1.0.0 copied to clipboard

EnumOptionSet is a Dart package that provides a way to manage a set of enum options. It allows you to add, remove, and check options in a set, and perform set operations like union, intersection, and [...]

example/enum_option_set_example.dart

import 'package:enum_option_set/enum_option_set.dart';

enum Topping {
  nuts,
  whippedCream,
  chocolateSauce,
}

void main() {
  final topping = EnumOptionSet<Topping>([]);
  print(topping.isEmpty); // true

  topping.add(Topping.nuts); // [nuts]
  print(topping);
  print(topping.isNotEmpty); // true
  print(topping.contains(Topping.nuts)); // true
  print(topping.contains(Topping.whippedCream)); // false

  topping.addAll([
    Topping.whippedCream,
    Topping.chocolateSauce
  ]); // [nuts, whippedCream, chocolateSauce]
  print(topping);

  print(topping.containsAll([
    Topping.nuts,
    Topping.whippedCream,
    Topping.chocolateSauce,
  ])); // true

  topping.remove(Topping.nuts); // [whippedCream, chocolateSauce]
  print(topping.contains(Topping.nuts)); // false
  print(topping);
}
2
likes
150
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

EnumOptionSet is a Dart package that provides a way to manage a set of enum options. It allows you to add, remove, and check options in a set, and perform set operations like union, intersection, and difference.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on enum_option_set