I have a standard ElevatedButton action:
ElevatedButton(
onPressed: () => myPolicySet.serialize(),
child: const Text('serialize'),
),
I also want it to navigate to a new page:
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const DiagramAppTwo()),
},
child: const Text('serialize'),
),
Is this possible? if so, how should I do it?
2
Answers
you’re free to setup a how much actions you want
like:
onPressed: () { FirstAction(); SecondAction();}
in your example,it should be :
Can’t you make a separate function and pass to onPressed?? And in that function you can write the code for both.