finished property

Future<void> get finished

Completes when the current playback ends, HOWEVER it ends — running out of timeline, finish, or stop. Ask status which.

A property rather than something play returns, so several things can await one playback, and so awaiting a player that is not playing is simply an answer rather than a hang.

Implementation

Future<void> get finished => isPlaying || _status == MotionPlayerStatus.paused
    ? (_finished ??= Completer<void>()).future
    : Future.value();