mucke/lib/system/models/playback_state_model.dart
2020-04-10 20:12:26 +02:00

26 lines
721 B
Dart

import 'package:audio_service/audio_service.dart';
import '../../domain/entities/playback_state.dart' as entity;
class PlaybackStateModel {
static entity.PlaybackState fromASPlaybackState(PlaybackState playbackState) {
if (playbackState == null) {
return null;
}
switch (playbackState.basicState) {
case BasicPlaybackState.none:
return entity.PlaybackState.none;
case BasicPlaybackState.stopped:
return entity.PlaybackState.stopped;
case BasicPlaybackState.paused:
return entity.PlaybackState.paused;
case BasicPlaybackState.playing:
return entity.PlaybackState.playing;
default:
return entity.PlaybackState.none;
}
}
}