MusicPlayer class

Music Player

Constructors

MusicPlayer({void onLoading()?, void onPlaying()?, void onPaused()?, void onStopped()?, void onCompleted()?, void onPlayNext()?, void onPlayPrevious()?, void onDuration(Duration)?, void onPosition(Duration)?, void onError(String)?})

Properties

channel MethodChannel
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
onCompleted → (void Function()?)
Callback to be called when music is ended
final
onDuration → (void Function(Duration)?)
Callback to be called when computed duration is available
final
onError → (void Function(String)?)
Callback to be called when error
final
onLoading → (void Function()?)
Callback to be called when loading music
final
onPaused → (void Function()?)
Callback to be called when music is paused
final
onPlaying → (void Function()?)
Callback to be called when playing music
final
onPlayNext → (void Function()?)
Callback to be called when play next music
final
onPlayPrevious → (void Function()?)
Callback to be called when play previous music
final
onPosition → (void Function(Duration)?)
Callback to be called for updating position
final
onStopped → (void Function()?)
Callback to be called when music is stopped
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel() Future<void>
Cancel notification
dispose() Future<void>
Dispose
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<void>
Pause current music
play(Music music, {bool showPrevious = false, bool showNext = false}) Future<void>
Play the music
prepare(Music music) Future<void>
Prepare music before real playing (if we want to show loading notification)
resume() Future<void>
Resume current music
seek(Duration position) Future<void>
Seek to play on specified position
stop() Future<void>
Stop playing
toString() String
A string representation of this object.
inherited

Operators

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