build abstract method

BitPattern<List<int>> build([
  1. String? name
])

Compiles and returns a BitPattern capable of matching.

This relies on the default implementation BitPatternBuilder.build, which is a programmatic execution based on some pre-computed values from the provided List<BitPart>.

The result of BitPattern.capture returns a List<int>, which is a list encapsulating the bits that matched a BitPart.v, if any, indexed by their occurrence (left-to-right) when matched:

final pattern = BitPatternBuilder([
  BitPart.one,
  BitPart.zero,
  BitPart.one,
  BitPart.v(1)
]).build();

print(pattern.match(0xD /* 0b1101 */)); // [1]

Implementation

BitPattern<List<int>> build([String? name]);