internal library
Shared plumbing for the minted_* sibling packages. Not public API: no semver promise is
made about anything here, and a consumer importing it is on their own.
It exists because Dart privacy is library-scoped, so helpers used by more than one sibling have
to be importable to be shared at all. What lives here is exactly what more than one sector
needs; a helper with a single sector travels with it (see AGENTS.md, repo layout).
The practical constraint: siblings resolve against any minted 3.x, so this is frozen within a
major. Additive changes are fine, and a sibling raises its minted floor when it starts using
one. Breaking changes wait for the next core major.
Constants
- hexDigitsPerByte → const int
- How many hex digits spell one byte.
- hexRadix → const int
- The radix hex is written in.
- hyphen → const String
- The hyphen a canonical form puts back after parsing, where the standard fixes its position.
- zeroPad → const String
- The character a fixed-width field is left-padded with.
Properties
- cosmeticSeparators → RegExp
-
Whitespace and hyphens together: the separators a standard treats as cosmetic grouping, in a
value whose charset excludes both. Stripped by
Gtin,Imei,Isbn,IssnandPaymentCardNumber.final - digitsOnly → RegExp
-
A whole string of nothing but decimal digits.
final
- whitespace → RegExp
-
Whitespace alone, for a value whose charset is
A-Z0-9so a hyphen would be invalid rather than cosmetic. Stripped byIbanandBic.final
Functions
-
compact(
String input) → String -
inputwith its cosmetic grouping stripped. ForGtin,ImeiandPaymentCardNumber, whose charsets are digits alone, so case-folding would be a no-op. -
compactUpperCase(
String input) → String -
inputcompacted and case-folded, for a charset admitting letters too:Isbn,Isni,Issn. -
decimalCodeUnit(
int digitValue) → int -
The ASCII code unit spelling
digitValue, the inverse of decimalValue. -
decimalValue(
int codeUnit) → int -
The value of a single decimal character,
0-9. Anything else yields -1, so a number assembled from junk fails validation downstream rather than throwing here. -
decimalValues(
String input, [int start = 0, int? end]) → List< int> -
The values of
input's characters fromstarttoend(exclusive, the whole string when omitted), ready forDigits.tryFrom. -
hexBytes(
String hex) → Uint8List -
The bytes
hexspells, two digits per byte. -
hexDigits(
Iterable< int> bytes) → String -
bytesas lowercase hex, two digits each: the inverse of hexBytes. -
luhnCheckDigit(
String bodyDigits) → String -
The ISO/IEC 7812-1 Annex B (Luhn) mod-10 check digit for
bodyDigits, everything before a card number's final digit, assumed already separator-free. -
positiveZeroed(
double value) → double -
valuewith a negative zero's sign cleared, forGeoCoordinateandPercentage.-0.0equals0.0and hashes alike, so it is only the rendered form that needs this. -
unspacedUpperCase(
String input) → String -
inputwith whitespace alone stripped, then case-folded, for a charset where a hyphen is invalid rather than cosmetic:Bic,Iban,Isin.