Skip to content

Instantly share code, notes, and snippets.

@PeterHdd
Last active April 11, 2021 12:18
Show Gist options
  • Save PeterHdd/770af2dcbf0fae5af6a2b0cbcec4b914 to your computer and use it in GitHub Desktop.
Save PeterHdd/770af2dcbf0fae5af6a2b0cbcec4b914 to your computer and use it in GitHub Desktop.
if (_formKey.currentState.validate()) {
dbRef.push().set({
"name": nameController.text,
"age": ageController.text,
"type": dropdownValue
}).then((_) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Successfully Added')));
ageController.clear();
nameController.clear();
}).catchError((onError) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(onError)));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment