format method
passport format can be A21 90457 or A2190457
Implementation
String? format(String? passport, {bool withSpace = false}) {
if (passport == null) return null;
// remove the spaces
passport = passport.replaceAll(RegExp(r"\s+"), "");
if (withSpace) {
if (passport.length > 3) {
return (passport.substring(0, 3) + " " + passport.substring(3))
.toUpperCase();
}
}
return passport.toUpperCase();
}