getWithholdingRates function

List<WithholdingRate> getWithholdingRates(
  1. int taxYear, [
  2. String? section
])

Every case FBR's Withholding Tax Rate Card lists for the covered sections in a tax year (2025 to 2027), with its rates for persons on and not on the Active Taxpayers List and its references.

taxYear is e.g. 2027. Give section (e.g. '153', in any case) for that section only.

Returns the cases, or an empty list for a year that is not covered. Never throws.

getWithholdingRates(2027, '236K').first.nonAtlRule;
// WithholdingNonAtlRule.slabs

Implementation

List<WithholdingRate> getWithholdingRates(int taxYear, [String? section]) {
  final wanted = section == null ? null : jsToUpperCase(section);
  return [
    for (final r in _rows)
      if (r.taxYear == taxYear && (wanted == null || r.section == wanted))
        WithholdingRate(
          taxYear: r.taxYear,
          section: r.section,
          subType: r.subType,
          description: r.description,
          atlRate: r.atl.rate,
          atlSlabs: r.atl.slabs,
          nonAtlRule: r.nonAtlRule,
          nonAtlRate: r.nonAtl.rate,
          nonAtlSlabs: r.nonAtl.slabs,
          lateFilerSlabs: r.lateFiler?.slabs,
          threshold: r.threshold,
          cardRef: r.cardRef,
          lawRef: r.lawRef,
          statuteOverride: r.statuteOverride,
          note: r.note,
          circular: r.circular,
          source: r.source,
        ),
  ];
}