We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/// Original code // create a new task void createDialog() { showDialog( context: context, builder: (context) { return DefineDialog( controller: _controller, onSave: saveNewTask(), // Mistakes can be made in complex applications onCancel: () => Navigator.of(context).pop(), ); }, ); // save new task void saveNewTask() { setState(() { db.tasks.insert(0, [_controller.text, false]); _controller.clear(); }); Navigator.of(context).pop(); db.updateDatabase(); }
/// optimize // create a new task void createDialog() { showDialog( context: context, builder: (context) { return DefineDialog( controller: _controller, onSave: () => saveNewTask(context), onCancel: () => Navigator.of(context).pop(), ); }, ); // save new task void saveNewTask(BuildContext context) { setState(() { db.tasks.insert(0, [_controller.text, false]); _controller.clear(); }); Navigator.of(context).pop(); db.updateDatabase(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
/// Original code
// create a new task
void createDialog() {
showDialog(
context: context,
builder: (context) {
return DefineDialog(
controller: _controller,
onSave: saveNewTask(), // Mistakes can be made in complex applications
onCancel: () => Navigator.of(context).pop(),
);
},
);
// save new task
void saveNewTask() {
setState(() {
db.tasks.insert(0, [_controller.text, false]);
_controller.clear();
});
Navigator.of(context).pop();
db.updateDatabase();
}
/// optimize
// create a new task
void createDialog() {
showDialog(
context: context,
builder: (context) {
return DefineDialog(
controller: _controller,
onSave: () => saveNewTask(context),
onCancel: () => Navigator.of(context).pop(),
);
},
);
// save new task
void saveNewTask(BuildContext context) {
setState(() {
db.tasks.insert(0, [_controller.text, false]);
_controller.clear();
});
Navigator.of(context).pop();
db.updateDatabase();
}
The text was updated successfully, but these errors were encountered: