update function

dynamic update(
  1. dynamic context,
  2. XModel model,
  3. XDataModel instance
)

Implementation

update(context, XModel model, XDataModel instance) async {
  GlobalKey<FormState>? key = GlobalKey<FormState>();
  return await showDialog(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: model.form(key, instance),
          actions: [
            TextButton(
                onPressed: () {
                  Navigator.pop(context, model.formValue());
                },
                child: const Text('Update')),
            TextButton(
                onPressed: () {
                  Navigator.pop(context);
                },
                child: const Text('Cancel')),
          ],
        );
      });
}