pub package package publisher build

The enumerated package adds additional functionality around dart enums. One main aspect of this package is the EnumSet.


  • EnumSet - A Set implementation especially for enums.
  • EnumSet provides additional functionalities and more efficient implementations for specific set operations.

Getting started

Add the package to your pubspec.yaml:

 enumerated: ^0.1.1

In your dart file, import the library:

import 'package:enumerated/enumerated.dart';


Creating an EnumSet:

In order to create an EnumSet you can choose from one of the following factory methods:

  • EnumSet.of(List, Iterable): Creates an EnumSet with the given values.
  • EnumSet.noneOf(List): Creates an empty EnumSet.
  • EnumSet.allOf(List): Creates an EnumSet with all values of the given enum.
  • EnumSet.complementOf(EnumSet): Creates an EnumSet with all values which are not contained in the other EnumSet
enum Numbers {one, two, three;}
var set1 = EnumSet.of(Numbers.values, []);
var set2 = EnumSet.noneOf(Numbers.values);
var set3 = EnumSet.allOf(Numbers.values);
var set4 = EnumSet.complementOf(set1);

Note that for every factory method other than complementOf you need to provide the full list of possible enum values as first parameter.

Adding and removing data:


Other useful functionalities:

  • fill(): Will add all enum values to the set.
  • complement(): Will return a new EnumSet with all values which are not contained in the current set.
  • copy(): Creates a exact copy of the current set.

Additional information

If you have ideas for this package or want to help develop it yourself, don't hesitate to open an issue or create a pull request. I am grateful for any help!


The enumerated library adds useful functionality to dart enums