Skip to content

Fix(iban): return error instead of throwing on non-alphanumeric characters - #169

Open
eugeniobaglieri wants to merge 2 commits into
flutter-form-builder-ecosystem:mainfrom
eugeniobaglieri:fix/iban-invalid-characters
Open

eugeniobaglieri wants to merge 2 commits into
flutter-form-builder-ecosystem:mainfrom
eugeniobaglieri:fix/iban-invalid-characters

Conversation

@eugeniobaglieri

Copy link
Copy Markdown

Connection with issue(s)

Close #168

Solution description

  • isIBAN now checks regex.hasMatch(iban) before computing the checksum, so the documented regex is applied. The default regex is unchanged.
  • The checksum computation is wrapped in try/catch returning false. This covers the case the default regex lets through (\w matches _) and any custom, more permissive regex.
  • Guard clauses are split into one condition per line.

To Do

  • [ x] Read contributing guide
  • [ x] Check the original issue to confirm it is fully satisfied
  • [ x] Add solution description to help guide reviewers
  • [ x] Add unit test to verify new or fixed behaviour
  • [ x] If apply, add documentation to code properties and package readme

EBaglieriSkylabs and others added 2 commits October 7, 2026 20:23
isIBAN passed any char outside A-Z/0-9 to int.parse, throwing FormatException
(e.g. trailing '.', accents, newline from paste, '_', '+').

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.21%. Comparing base (2e108a1) to head (e9f11be).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #169   +/-   ##
=======================================
  Coverage   99.20%   99.21%           
=======================================
  Files          95       95           
  Lines        1012     1013    +1     
=======================================
+ Hits         1004     1005    +1     
  Misses          8        8           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IbanValidator throws FormatException on IBANs containing non-alphanumeric characters`

2 participants