encodeContent method

  1. @override
List<bool> encodeContent(
  1. String contents, [
  2. Map<EncodeHintType, Object?>? hints
])
override

Encode the contents to bool array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included.

@param contents barcode contents to encode @return a {@code List

Implementation

@override
List<bool> encodeContent(
  String contents, [
  Map<EncodeHintType, Object?>? hints,
]) {
  final forcedCodeSet = _check(contents, hints);

  final hasCompactionHint = hints != null &&
      hints.containsKey(EncodeHintType.CODE128_COMPACT) &&
      (hints[EncodeHintType.CODE128_COMPACT] as bool);

  return hasCompactionHint
      ? MinimalEncoder().encode(contents)
      : encodeFast(contents, hints, forcedCodeSet);
}