The simplistic way is undoubtedly to avoid auxiliary classes.
As of Dart 2.2 with the use of set literals, we can place the map of menu items in the app bar directly
appBar: AppBar(
title: Text('Homepage'),
actions: <Widget>[
PopupMenuButton<String>(
onSelected: handleClick,
itemBuilder: (BuildContext context) {
return {'Logout', 'Settings'}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
);
}).toList();
},
),
],
),
and handle click with value of Item text in method
void handleClick(String value) {
switch (value) {
case 'Logout':
break;
case 'Settings':
break;
}
}