class father extends StatelessWidget { var child; @override Widget build(BuildContext context) { child = son(); return Scaffold( body: child, floatingActionButton: FloatingActionButton( onPressed: () => child?.childFunction(), ), ); } } class son extends StatelessWidget { void childFunction() => print('called in child widget'); @override Widget build(BuildContext context) { return Container( color: Colors.red, ); } }