Skip to content

Commit 925ade1

Browse files
committed
Format
1 parent 54b24b5 commit 925ade1

File tree

2 files changed

+32
-30
lines changed

2 files changed

+32
-30
lines changed

lib/src/utils/validators.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ bool isJSON(String value) {
368368

369369
bool isLatitude(String value) {
370370
value = value.replaceAll(',', '.');
371-
371+
372372
final double? latitude = double.tryParse(value);
373373
if (latitude == null) {
374374
return false;
@@ -378,7 +378,7 @@ bool isLatitude(String value) {
378378

379379
bool isLongitude(String value) {
380380
value = value.replaceAll(',', '.');
381-
381+
382382
final double? longitude = double.tryParse(value);
383383
if (longitude == null) {
384384
return false;

test/form_builder_validators_test.dart

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -543,34 +543,36 @@ void main() {
543543
'FormBuilderValidators.phoneNumber',
544544
(WidgetTester tester) => testValidations(tester, (context) {
545545
final validator = FormBuilderValidators.phoneNumber();
546-
547-
// Valid phone numbers from various countries
548-
expect(validator('+1 800 555 5555'), isNull); // USA
549-
expect(validator('+44 20 7946 0958'), isNull); // UK
550-
expect(validator('+61 2 1234 5678'), isNull); // Australia
551-
expect(validator('+49 30 123456'), isNull); // Germany
552-
expect(validator('+33 1 23 45 67 89'), isNull); // France
553-
expect(validator('+81 3-1234-5678'), isNull); // Japan
554-
expect(validator('+91 98765 43210'), isNull); // India
555-
expect(validator('+86 10 1234 5678'), isNull); // China
556-
expect(validator('+55 11 91234-5678'), isNull); // Brazil
557-
expect(validator('+27 21 123 4567'), isNull); // South Africa
558-
559-
// Invalid phone numbers
560-
expect(validator('123-abc-defg'), isNotNull); // Contains letters
561-
expect(validator('+1-800-555-5555-0000'), isNotNull); // Too many digits
562-
expect(validator('+1 800 555 555'), isNotNull); // Too few digits
563-
expect(validator('++1 800 555 5555'), isNotNull); // Invalid prefix
564-
expect(validator('+1 (800) 555-5555'), isNotNull); // Invalid format
565-
expect(validator('+44 20 7946 0958 ext 123'), isNotNull); // Extension included
566-
expect(validator('+11234567890'), isNotNull); // Missing spaces or dashes
567-
expect(validator('1-800-555-5555'), isNotNull); // Missing country code
568-
expect(validator('+1 800 5555 5555'), isNotNull); // Incorrect digit grouping
569-
expect(validator('+44 2079460958'), isNotNull); // No spaces
570-
571-
// Edge cases
572-
expect(validator(''), isNotNull); // Empty string
573-
expect(validator(null), isNotNull); // Null value
546+
547+
// Valid phone numbers from various countries
548+
expect(validator('+1 800 555 5555'), isNull); // USA
549+
expect(validator('+44 20 7946 0958'), isNull); // UK
550+
expect(validator('+61 2 1234 5678'), isNull); // Australia
551+
expect(validator('+49 30 123456'), isNull); // Germany
552+
expect(validator('+33 1 23 45 67 89'), isNull); // France
553+
expect(validator('+81 3-1234-5678'), isNull); // Japan
554+
expect(validator('+91 98765 43210'), isNull); // India
555+
expect(validator('+86 10 1234 5678'), isNull); // China
556+
expect(validator('+55 11 91234-5678'), isNull); // Brazil
557+
expect(validator('+27 21 123 4567'), isNull); // South Africa
558+
559+
// Invalid phone numbers
560+
expect(validator('123-abc-defg'), isNotNull); // Contains letters
561+
expect(validator('+1-800-555-5555-0000'), isNotNull); // Too many digits
562+
expect(validator('+1 800 555 555'), isNotNull); // Too few digits
563+
expect(validator('++1 800 555 5555'), isNotNull); // Invalid prefix
564+
expect(validator('+1 (800) 555-5555'), isNotNull); // Invalid format
565+
expect(validator('+44 20 7946 0958 ext 123'),
566+
isNotNull); // Extension included
567+
expect(validator('+11234567890'), isNotNull); // Missing spaces or dashes
568+
expect(validator('1-800-555-5555'), isNotNull); // Missing country code
569+
expect(
570+
validator('+1 800 5555 5555'), isNotNull); // Incorrect digit grouping
571+
expect(validator('+44 2079460958'), isNotNull); // No spaces
572+
573+
// Edge cases
574+
expect(validator(''), isNotNull); // Empty string
575+
expect(validator(null), isNotNull); // Null value
574576
}),
575577
);
576578

0 commit comments

Comments
 (0)