I wonder if there is a way to avoid setting null to actions if i have this state condition:
appBar: AppBar(
title: provider.appBarTitle,
actions: provider.editState == EditState.inactive
? [
IconButton(
onPressed: provider.activateEditableState,
icon: const Icon(Icons.edit))
]
: null)
CodePudding user response:
It should be fine if you return an empty list instead of null
.
appBar: AppBar(
title: provider.appBarTitle,
actions: [
if (provider.editState == EditState.inactive)
IconButton(
onPressed: provider.activateEditableState,
icon: const Icon(Icons.edit),
),
],
),