MemoryModelEnumConstraint constructor

MemoryModelEnumConstraint({
  1. required int offset,
  2. required int width,
  3. required Iterable<BigInt> encodings,
})

Freezes the field's legal encodings.

Implementation

MemoryModelEnumConstraint({
  required this.offset,
  required this.width,
  required Iterable<BigInt> encodings,
}) : encodings = List.unmodifiable(encodings) {
  if (offset < 0 ||
      width < 1 ||
      this.encodings.isEmpty ||
      this.encodings.any(
          (value) => value < BigInt.zero || value >= (BigInt.one << width))) {
    throw ArgumentError('Invalid enum payload constraint.');
  }
}