convertlib release
convertlib 3.7.0
- [Breaking Changes]
ByteCollector.bigInt()now defaults toEndian.big, matchingnumber(). Passendian: Endian.littleto get the old values. The top-leveltoBigIntstill defaults to little endian.- The hex, octal, and UTF-8 decoders now throw a
FormatExceptionon input values outside0..255. They used to keep only the low 8 bits, sofromUtf8([0x141])returned"A". UseallowMalformed: trueorUTF8Codec.lenientto keep the old UTF-8 behavior.
- New codecs. Each one comes with
to<Name>,from<Name>, andtryFrom<Name>, and all except Punycode and Bech32 also haveto<Name>Bytes:- Base-36:
Base36Codecwithstandard(lowercase) andupper. Decoding accepts either case. - Base-45 (RFC 9285):
Base45Codec.standard. - Base-58:
Base58Codecwith the Bitcoin (standard), Flickr (flickr), and Ripple (ripple) alphabets. - Base-62:
Base62Codecwithstandard(0-9A-Za-z) andlowerFirst(0-9a-zA-Z). - Base-85:
Base85Codecwith Ascii85 (standard), Z85 (z85), the git alphabet (git), and the RFC 1924 IPv6 form (ipv6). - Bech32 (BIP-173) and Bech32m (BIP-350):
Bech32Codecwithbech32,bech32m, andlightning(no 90-character limit), decoding toBech32Data. SegWit addresses getSegwitCodec,SegwitAddress,toSegwitAddress,fromSegwitAddress, andtryFromSegwitAddress. - Percent-encoding (RFC 3986):
PercentCodecwithstandard(unreserved characters only),component(likeUri.encodeComponent),form(likeUri.encodeQueryComponent, with+for a space), andPercentCodec.customfor your own set of unreserved characters. UnlikeUri, it encodes any bytes, not only UTF-8. - Punycode (RFC 3492):
PunycodeCodecwithstandard, anddomainfor thexn--labels of internationalized domain names.
- Base-36:
- Base-36, Base-58, and Base-62 write each leading zero byte as the
alphabet's first character (
0, or1in Bitcoin Base-58), so leading zeros survive a roundtrip. - Export the
RadixEncoderandRadixDecoderbase classes, which convert bytes to and from any radix up to 255. Base-36, Base-58, and Base-62 are built on them. - Add the
Base64Codec.imapalphabet (A-Za-z0-9+,, not padded), the modified Base-64 of IMAP mailbox names (RFC 3501). - Add
base36(),base45(),base58(),base62(),base85(), andbech32(hrp)toByteCollector. - Add
allowMalformedtofromUtf8,tryFromUtf8, andByteCollector.utf8(), and theUTF8Codec.lenientcodec. They clip out-of-range values and decode ill-formed UTF-8 toU+FFFD, asdart:convertdoes, instead of throwing. ByteCollector.utf8()now decodes withfromUtf8instead ofdart:convert. It accepts and rejects the same bytes, but its error messages now name the failing byte and its position.UTF8Decoder.decodenow accepts anyList<int>.- Fix
fromHexaccepting:;<=>?as the digitsA-F. - Fix
CryptDataBuilder.buildsharing its parameter map with the builtCryptData, so laterparamcalls changed the built value. - Speed up UTF-8 encoding and decoding on the VM, especially for ASCII text.