MediaControl class Null safety

A button to appear in the Android notification, lock screen, Android smart watch, or Android Auto device. The set of buttons you would like to display at any given moment should be streamed via AudioHandler.playbackState.

Each MediaControl button controls a specified MediaAction. Only the following actions can be represented as buttons:

Predefined controls with default Android icons and labels are defined as static fields of this class. If you wish to define your own custom Android controls with your own icon resources, you will need to place the Android resources in android/app/src/main/res. Here, you will find a subdirectory for each different resolution:

drawable-hdpi
drawable-mdpi
drawable-xhdpi
drawable-xxhdpi
drawable-xxxhdpi

You can use Android Asset Studio to generate these different subdirectories for any standard material design icon.

Constructors

MediaControl({required String androidIcon, required String label, required MediaAction action})
Creates a custom MediaControl.
const

Properties

action MediaAction
The action to be executed by this control
final
androidIcon String
A reference to an Android icon resource for the control (e.g. "drawable/ic_action_pause")
final
hashCode int
The hash code for this object.
read-only, override
label String
A label for the control
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Constants

fastForward → const MediaControl
A default control for MediaAction.fastForward.
MediaControl(androidIcon: 'drawable/audio_service_fast_forward', label: 'Fast Forward', action: MediaAction.fastForward)
pause → const MediaControl
A default control for MediaAction.pause.
MediaControl(androidIcon: 'drawable/audio_service_pause', label: 'Pause', action: MediaAction.pause)
play → const MediaControl
A default control for MediaAction.play.
MediaControl(androidIcon: 'drawable/audio_service_play_arrow', label: 'Play', action: MediaAction.play)
rewind → const MediaControl
A default control for MediaAction.rewind.
MediaControl(androidIcon: 'drawable/audio_service_fast_rewind', label: 'Rewind', action: MediaAction.rewind)
skipToNext → const MediaControl
A default control for MediaAction.skipToNext.
MediaControl(androidIcon: 'drawable/audio_service_skip_next', label: 'Next', action: MediaAction.skipToNext)
skipToPrevious → const MediaControl
A default control for MediaAction.skipToPrevious.
MediaControl(androidIcon: 'drawable/audio_service_skip_previous', label: 'Previous', action: MediaAction.skipToPrevious)
stop → const MediaControl
A default control for MediaAction.stop.
MediaControl(androidIcon: 'drawable/audio_service_stop', label: 'Stop', action: MediaAction.stop)