# form {{tag>flutter form validation validate}} ### form validation _buildSaveButton() { return RoundedLoadingButton( child: Text('Save', style: TextStyle(color: Colors.white)), controller: _btnController, onPressed: () { // save item if (_formKey.currentState!.validate()) { // If the form is valid, display a snackbar. In the real world, // you'd often call a server or save the information in a database. ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text('Processing Data'))); } }, ); }