pakdatakit 2.3.0
pakdatakit: ^2.3.0 copied to clipboard
Pakistani data utilities: CNIC, phone, IBAN, postal codes, addresses, Hijri dates, holidays, amounts in words and Raast QR codes. Pure Dart, all platforms.
Changelog #
2.3.0 #
Breaking for exhaustive switches #
BankTypehas a new value,BankType.publicSector('public-sector'; see Data depth below). Dart 3 checksswitchstatements and expressions over an enum for exhaustiveness, so aswitchoverBankTypewithout a default (_) case stops compiling until it handles the new value. Nothing else changes at runtime for such code, but National Bank of Pakistan, Sindh Bank, The Bank of Khyber and The Bank of Punjab now reportBankType.publicSectorinstead ofBankType.commercial.
Added #
validatePassport(): format check for Pakistani passport numbers (two letters, seven digits). DGIP does not publish the format, so this checks the common shape only. Also aspackage:pakdatakit/passport.dart.validateVehiclePlate()andparseVehiclePlate(): series, number and optional year of a vehicle registration number (1–4 letters, 1–4 digits). Provinces use different formats, so this checks the shape they share. Also aspackage:pakdatakit/vehicle.dart.getPostOffice()andsearchPostOffices()(also inpackage:pakdatakit/postal.dart): every delivery post office in Pakistan Post's directory (about 2,560), asPostOfficevalues (code,office,town,district,province), including offices in towns and villages thatgetCityByPostalCodedoes not cover. The directory is in its own source file and only these two functions reference it, so release builds that do not call them leave it out.- All of these are checked against the shared test vectors. See DATA.md in the repository for sources and limits.
Data (November 2026 audit, see AUDIT.md and DATA.md in the repository):
banks ZTBL (Zarai Taraqiati Bank Limited) and SMFB (Sindh Microfinance
Bank) added; TMFB/TAMW renamed "Easypaisa Bank Limited" and JCMA/WMBL
"Mobilink Microfinance Bank (JazzCash)"; eight postal codes corrected from
Pakistan Post's directory (Gilgit, Dera Ismail Khan, Tank, Badin, Thatta,
Sujawal, Matiari, Taxila) and Wah Cantonment 47040 added; holiday source
links for 2024 to 2026 now point to official notifications.
Data depth:
getDivisions(),getDivisionOfDistrict(),getTehsils()andgetTehsilDistrict(): division and tehsil lookups from the 2023 census (30 divisions, 591 tehsils). Each tehsil is recorded under its census district, so districts created since the census may list few or no tehsils and have no division.- Postal codes now hold every office in Pakistan Post's directory that
belongs to a listed city: 457 codes, up from 110.
getCityByPostalCodestill returns a listed city ornull, so a village office's code returnsnull(usegetPostOfficefor those). Compared with 2.2.1 it gives a different answer for eight codes:47040is Wah Cantonment (was Taxila), and15700,29120,29430,70100,72220,73020and73220, which were given as the main code of a city but belong to a village office nearby, now returnnull. - 41 more landline area codes.
BankType.publicSector('public-sector') for public sector commercial banks;BankType.commercialnow means private commercial banks.- SME Bank (
SMES) is reported as inactive (active: false).
dataVersion is now 2026-11-17.
2.2.1 #
The district split from Swat in January 2026 is now named Bar Swat, as in
the Khyber Pakhtunkhwa Board of Revenue notification of 27 January 2026,
instead of "Upper Swat". "Upper Swat" still resolves in getDistrictProvince to Khyber Pakhtunkhwa.
dataVersion is now 2026-11-07.
2.2.0 #
Initial Dart release, matching version 2.2.0 of the
pakdatakit npm package (datasets
checked 2026-10-14).
- Every function of the npm package, with the same names: CNIC, mobile numbers and networks, WhatsApp links, IBAN and banks, postal codes, cities and districts, address parsing, text and Roman Urdu, Hijri dates, public holidays, PKR formatting, amounts in words, NTN/STRN, landlines and other numbers, Raast QR codes, and form-input helpers.
- Pure Dart with no dependencies; the datasets are embedded, so it works on every platform, including Flutter web.
- Per-module libraries mirroring the npm entry points
(
package:pakdatakit/cnic.dart, …). - Tested against the 12,080 shared test vectors generated from the TypeScript library, on the Dart VM and compiled to JavaScript.