@@ -54,8 +54,8 @@ class _SignupFormState extends State<SignupForm> {
54
54
decoration: InputDecoration (
55
55
labelText: 'Confirm Password' ,
56
56
suffixIcon: (_formKey.currentState != null &&
57
- ! _formKey.currentState.fields['confirm_password' ]
58
- .isValid)
57
+ ! ( _formKey.currentState? .fields['confirm_password' ]
58
+ ? .isValid ?? false ) )
59
59
? const Icon (Icons .error, color: Colors .red)
60
60
: const Icon (Icons .check, color: Colors .green),
61
61
),
@@ -68,7 +68,7 @@ class _SignupFormState extends State<SignupForm> {
68
68
: null),*/
69
69
(val) {
70
70
if (val !=
71
- _formKey.currentState.fields['password' ].value) {
71
+ _formKey.currentState? .fields['password' ]? .value) {
72
72
return 'Passwords do not match' ;
73
73
}
74
74
return null ;
@@ -84,7 +84,7 @@ class _SignupFormState extends State<SignupForm> {
84
84
]),
85
85
// initialValue: true,
86
86
decoration: InputDecoration (labelText: 'Accept Terms?' ),
87
- builder: (FormFieldState <bool > field) {
87
+ builder: (FormFieldState <bool ? > field) {
88
88
return InputDecorator (
89
89
decoration: InputDecoration (
90
90
errorText: field.errorText,
@@ -108,12 +108,12 @@ class _SignupFormState extends State<SignupForm> {
108
108
style: TextStyle (color: Colors .white),
109
109
),
110
110
onPressed: () {
111
- if (_formKey.currentState.saveAndValidate ()) {
111
+ if (_formKey.currentState? .saveAndValidate () ?? false ) {
112
112
print ('Valid' );
113
113
} else {
114
114
print ('Invalid' );
115
115
}
116
- print (_formKey.currentState.value);
116
+ print (_formKey.currentState? .value);
117
117
},
118
118
)
119
119
],
0 commit comments