class MyHomePage extends StatefulWidget{ const MyHomePage({super.key}); @override State<MyHomePage> createState() => MyHomePageState(); } class MyHomePageState extends State<MyHomePage>{ String _name = "Sumi"; Widget build(BuildContext context){ return Scaffold( body: Center(child: ElevatedButton( child: Text(_name), onPressed: (){ setState(() { }); _name = _name == "Sumi"?"Roma":"Sumi"; }, ), ), ); } }