Flutter calling child class function from parent class

前端 未结 4 1386
生来不讨喜
生来不讨喜 2021-01-04 04:01

Code:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(         


        
4条回答
  •  一个人的身影
    2021-01-04 04:40

    Actually, you can't do that because _HomePageState is private. Delete the _ symbol ahead of HomePageState, so it will be public and you can call methodA() using the HomePageState().methodA();

提交回复
热议问题