Skip to content

Commit 9e8233b

Browse files
authored
Some constructors can be const
This is more performant for things like media control objects which you usually would hard-code, rather than create dynamically at runtime.
1 parent 2b7b22a commit 9e8233b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/audio_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class PlaybackState {
6565
/// The time at which the playback position was last updated
6666
final int updateTime;
6767

68-
PlaybackState({
68+
const PlaybackState({
6969
@required this.basicState,
7070
@required this.actions,
7171
this.position,
@@ -222,7 +222,7 @@ class MediaItem {
222222
/// The rating of the MediaItem.
223223
final Rating rating;
224224

225-
MediaItem({
225+
const MediaItem({
226226
@required this.id,
227227
@required this.album,
228228
@required this.title,
@@ -256,7 +256,7 @@ class MediaControl {
256256
/// The action to be executed by this control
257257
final MediaAction action;
258258

259-
MediaControl({
259+
const MediaControl({
260260
this.androidIcon,
261261
@required this.label,
262262
@required this.action,

0 commit comments

Comments
 (0)