Changelog
The full release history is in the changelog:
4.0.0 highlights
Section titled “4.0.0 highlights”4.0 is a near-total rewrite for modern Dart (3.13+). Almost every class has breaking changes. Read Upgrading to 4.0 before you upgrade.
Breaking
Section titled “Breaking”- Dart 3.13 or later is required. Classes are now
final, so you can’t extend or implement them. NepaliDateTimeis instant-based, likeDateTime. It can be local, UTC or Nepal Time.NepaliDateTime.now()now returns local time. UsenepalNow()for Nepal time.DateTime.toNepaliDateTime()keeps the time zone. Add.toNepalTime()to get the old behaviour.- Out-of-range components are normalised,
==compares values, andparsefollowsDateTime.parse.
NepaliDateFormatfollows intl’sDateFormat: intl’s skeleton layouts and pattern letters, and it’s immutable.NepaliNumberFormatfollows intl’sNumberFormat. Named constructors andcopyWithreplace the old constructor flags. Numbers are rounded instead of truncated.NepaliUtilsis static:NepaliUtils.defaultLanguage = …andwithLanguage.NepaliMomentis an immutable formatter. Its English phrases and thresholds now match moment.js.NepaliUnicodeis aconstinstance with styles:const NepaliUnicode().convert(…).live: truebecameconvertLive.{…}now escapes text.
- Measurement units:
NepaliArea,NepaliWeightandNepaliVolume. - Phone numbers:
NepaliPhoneNumber, with the operator, the district, formatting andfindAll. - Preeti & Devanagari:
Preeti.toUnicode/fromUnicodeand theDevanagarihelpers. - Unicode styles:
google,mppRomanizedandmppTraditional, plustoRomanand stream support. - Moment:
formatDuration,formatUnit,calendar, a short style, and weeks. - Number formatting: percent, currency, compact (
12.3L), real number words, custom patterns and parsing. - Date formatting: the
L,c,D,K,k,z/vandZletters, skeleton constants andaddPattern. Languageconverts to and from locales.
Performance
Section titled “Performance”- AD → BS conversion is about 16× faster, and
weekdayis about 500× faster. NepaliUnicodeconverts in a single pass. 10,000 characters take about 0.4 ms instead of 13.6 s.
