BitPatternBuilder class abstract

Builds a sequence of binary digits.

The pattern may only contain 0s, 1s, and variable-length dynamic segments.

Usage

final pattern = BitPattern([
  BitPart.one,
  BitPart.zero,
  BitPart.one,
  BitPart.v(1, 'FLAG'),
])
0x3.matches(pattern); // == true
0xB.matches(pattern); // == true
0xF.matches(pattern); // == false

NOTE: To be able to compile a BitPattern into ahead-of-time generated code in the future, ensure that the resulting type is a compile-time constant (const).

Annotations
  • @sealed

Constructors

BitPatternBuilder(List<BitPart> parts)
Creates a new builder of the provided parts.
const
factory
BitPatternBuilder.parse(String bits)
Creates a new builder that will parse bits.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build([String? name]) BitPattern<List<int>>
Compiles and returns a BitPattern capable of matching.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited