From 6a38156b140723eb4b1c97b0ba3792327db71a07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Sep 2026 12:42:04 +0000 Subject: [PATCH 1/2] chore(deps): bump very_good_analysis from 10.3.0 to 11.0.0 Bumps [very_good_analysis](https://github.com/VeryGoodOpenSource/very_good_analysis) from 10.3.0 to 11.0.0. - [Release notes](https://github.com/VeryGoodOpenSource/very_good_analysis/releases) - [Changelog](https://github.com/VeryGoodOpenSource/very_good_analysis/blob/main/CHANGELOG.md) - [Commits](https://github.com/VeryGoodOpenSource/very_good_analysis/compare/v10.3.0...v11.0.0) --- updated-dependencies: - dependency-name: very_good_analysis dependency-version: 11.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9b62075..4204670 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,4 +15,4 @@ dependencies: dev_dependencies: test: ^1.26.3 - very_good_analysis: ^10.3.0 + very_good_analysis: ">=10.3.0 <12.0.0" From 2fdd9cee9aeb16144832510f7ca48387e86f8a13 Mon Sep 17 00:00:00 2001 From: "unicoderbot[bot]" <269805761+unicoderbot[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2026 13:27:34 +0000 Subject: [PATCH 2/2] fix: address review feedback on PR #165 Co-authored-by: erickzanardo --- example/lib/main.dart | 19 ++++++++++--------- example/test/main_test.dart | 25 +++++++++---------------- lib/formz.dart | 6 +++--- test/helpers/name_input.dart | 10 +++++----- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index a5597ec..fecbbec 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -6,7 +6,7 @@ import 'package:formz/formz.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { - const MyApp({super.key}); + const new({super.key}); @override Widget build(BuildContext context) { @@ -23,7 +23,7 @@ class MyApp extends StatelessWidget { } class MyForm extends StatefulWidget { - MyForm({super.key, Random? seed}) : seed = seed ?? Random(); + new({super.key, Random? seed}) : seed = seed ?? Random(); final Random seed; @@ -168,7 +168,7 @@ class _MyFormState extends State { } class MyFormState with FormzMixin { - MyFormState({ + new({ Email? email, this.password = const Password.pure(), this.status = FormzSubmissionStatus.initial, @@ -198,9 +198,9 @@ enum EmailValidationError { invalid, empty } class Email extends FormzInput with FormzInputErrorCacheMixin { - Email.pure([super.value = '']) : super.pure(); + new pure([super.value = '']) : super.pure(); - Email.dirty([super.value = '']) : super.dirty(); + new dirty([super.value = '']) : super.dirty(); static final _emailRegExp = RegExp( r'^[a-zA-Z\d.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*$', @@ -221,12 +221,13 @@ class Email extends FormzInput enum PasswordValidationError { invalid, empty } class Password extends FormzInput { - const Password.pure([super.value = '']) : super.pure(); + const new pure([super.value = '']) : super.pure(); - const Password.dirty([super.value = '']) : super.dirty(); + const new dirty([super.value = '']) : super.dirty(); - static final _passwordRegex = - RegExp(r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$'); + static final _passwordRegex = RegExp( + r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$', + ); @override PasswordValidationError? validator(String value) { diff --git a/example/test/main_test.dart b/example/test/main_test.dart index 33ebdc5..230a074 100644 --- a/example/test/main_test.dart +++ b/example/test/main_test.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mocktail/mocktail.dart'; -class MockRandom extends Mock implements Random {} +class MockRandom extends Mock implements Random; final _seed = MockRandom(); @@ -70,10 +70,7 @@ void main() { testWidgets('empty email', (tester) async { await tester.pumpMyForm(); - await tester.enterText( - find.byKey(const Key('myForm_emailInput')), - '', - ); + await tester.enterText(find.byKey(const Key('myForm_emailInput')), ''); await tester.pumpAndSettle(); await tester.enterText( @@ -85,10 +82,7 @@ void main() { await tester.pumpAndSettle(); await tester.pumpAndSettle(); - expect( - find.text('Please ensure the email entered is valid'), - findsOneWidget, - ); + expect(find.text('Please enter an email'), findsOneWidget); }); testWidgets('invalid password', (tester) async { @@ -135,12 +129,7 @@ void main() { await tester.pumpAndSettle(); await tester.pumpAndSettle(); - expect( - find.text( - '''Password must be at least 8 characters and contain at least one letter and number''', - ), - findsOneWidget, - ); + expect(find.text('Please enter a password'), findsOneWidget); }); }); }); @@ -148,6 +137,10 @@ void main() { extension on WidgetTester { Future pumpMyForm() async { - await pumpWidget(MaterialApp(home: Scaffold(body: MyForm(seed: _seed)))); + await pumpWidget( + MaterialApp( + home: Scaffold(body: MyForm(seed: _seed)), + ), + ); } } diff --git a/lib/formz.dart b/lib/formz.dart index 2639574..e119ad3 100644 --- a/lib/formz.dart +++ b/lib/formz.dart @@ -64,13 +64,13 @@ extension FormzSubmissionStatusX on FormzSubmissionStatus { /// {@endtemplate} @immutable abstract class FormzInput { - const FormzInput._({required this.value, this.isPure = true}); + const new _({required this.value, this.isPure = true}); /// Constructor which create a `pure` [FormzInput] with a given value. - const FormzInput.pure(T value) : this._(value: value); + const new pure(T value) : this._(value: value); /// Constructor which create a `dirty` [FormzInput] with a given value. - const FormzInput.dirty(T value) : this._(value: value, isPure: false); + const new dirty(T value) : this._(value: value, isPure: false); /// The value of the given [FormzInput]. /// For example, if you have a `FormzInput` for `FirstName`, diff --git a/test/helpers/name_input.dart b/test/helpers/name_input.dart index 35990ad..e02aafe 100644 --- a/test/helpers/name_input.dart +++ b/test/helpers/name_input.dart @@ -3,8 +3,8 @@ import 'package:formz/formz.dart'; enum NameInputError { empty } class NameInput extends FormzInput { - const NameInput.pure({String value = ''}) : super.pure(value); - const NameInput.dirty({String value = ''}) : super.dirty(value); + const new pure({String value = ''}) : super.pure(value); + const new dirty({String value = ''}) : super.dirty(value); @override NameInputError? validator(String value) { @@ -13,7 +13,7 @@ class NameInput extends FormzInput { } class NameInputFormzMixin with FormzMixin { - NameInputFormzMixin({this.name = const NameInput.pure()}); + new({this.name = const NameInput.pure()}); final NameInput name; @@ -25,8 +25,8 @@ class NameInputFormzMixin with FormzMixin { // ignore: must_be_immutable class NameInputErrorCacheMixin extends FormzInput with FormzInputErrorCacheMixin { - NameInputErrorCacheMixin.pure({String value = ''}) : super.pure(value); - NameInputErrorCacheMixin.dirty({String value = ''}) : super.dirty(value); + new pure({String value = ''}) : super.pure(value); + new dirty({String value = ''}) : super.dirty(value); int validatorCalls = 0;