I have the following IconButton in Flutter which when onPressed
, triggers an audioplayer to play;
IconButton(
key: const Key('play_button'),
onPressed: _play,
iconSize: 30,
icon: Icon(PlayerButtons.playbuttonbig),
),
But why would it fail to play when I do this instead?
IconButton(
key: const Key('play_button'),
onPressed:(){
_play;
},
iconSize: 30,
icon: Icon(PlayerButtons.playbuttonbig),
),
The reason I need to use the 2nd is because I want to call another function before or after "_play"
IconButton(
key: const Key('play_button'),
onPressed:(){
_play(); //<- call the play function like this
},
iconSize: 30,
icon: Icon(PlayerButtons.playbuttonbig),
),