From e8b6d6d6bbac2ebef97f19f98829b77ca94113b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Huertas?= <123009293+huertin03@users.noreply.github.com> Date: Fri, 28 Jul 2023 19:51:59 +0200 Subject: [PATCH] Update login_screen.dart to validate if form.validate() is false or true, you have to assure it is not null first. --- chapter_05/lib/login_screen.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chapter_05/lib/login_screen.dart b/chapter_05/lib/login_screen.dart index f5ee105..012d50e 100644 --- a/chapter_05/lib/login_screen.dart +++ b/chapter_05/lib/login_screen.dart @@ -67,7 +67,8 @@ class _LoginScreenState extends State { void _validate() { final form = _formKey.currentState; - if (!form.validate()) { + bool correctValidation = form?.validate() ?? false; + if (!correctValidation) { return; } final name = _nameController.text;