Solved
I have followed this topic https://medium.com/@dnkibere/passing-a-function-as-an-argument-flutter-e011ad2afd86 and it works now:
body: Column(
children: [
RecipeTypeButtons(
filterResult: (String mealTypeFilter) {
_updateFilterText(mealTypeFilter);
},
),
],
),
And in the external class:
class RecipeTypeButtons extends StatelessWidget {
final Function(String val) filterResult;
const RecipeTypeButtons({super.key, required this.filterResult});