--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/9547bf62-bf65-4d5a-8e9a-a076d030e650%40googlegroups.com.
Hi,Because the onPressed is being fired immediately the widget builds modify as: onPressed: ()=> (_formKey.currentState.validate() || _photoCount == 0) ? null : () {},Best regardsOlaide Nojeem Ekeolere
On Thu, 20 Feb 2020 at 10:10, Mr harilall <harila...@gmail.com> wrote:
Hi,--I have created a form keyfinal _formKey = GlobalKey<FormState>();I have also assigned this key to my formForm( key: _formKey)Then in my Raised Button's onPressed method I have this code to disable the button if the form is invalidonPressed: (_formKey.currentState.validate() || _photoCount == 0) ? null : () {},Now as far as I know this code is only supposed to run once the button is actually pressed but it seems to fire once the view is loaded somehow and it gives me the following errorNoSuchMethodError: The method 'validate' was called on null. Receiver: null Tried calling: validate()I have also been through every text and number input and made sure they all have validator functions but that didn't work. How do I resolve this?
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/c22f8be0-ec38-406f-a486-b17a44e7df22%40googlegroups.com.