@@ -39,7 +39,6 @@ class HomeState extends State<Home> {
39
39
lineLength: 120 , // width of the output
40
40
colors: true , // Colorful log messages
41
41
printEmojis: true , // Print an emoji for each log message
42
- printTime: true ,
43
42
),
44
43
);
45
44
@@ -767,21 +766,25 @@ class HomeState extends State<Home> {
767
766
768
767
Future <void > checkIfAppIsActive (BuildContext context) async {
769
768
try {
770
- await SpotifySdk .isSpotifyAppActive.then ((isActive) {
771
- final snackBar = SnackBar (
772
- content: Text (isActive
773
- ? 'Spotify app connection is active (currently playing)'
774
- : 'Spotify app connection is not active (currently not playing)' ));
775
-
776
- ScaffoldMessenger .of (context).showSnackBar (snackBar);
777
- });
769
+ final isActive = await SpotifySdk .isSpotifyAppActive;
770
+ _showSnackBar (isActive);
778
771
} on PlatformException catch (e) {
779
772
setStatus (e.code, message: e.message);
780
773
} on MissingPluginException {
781
774
setStatus ('not implemented' );
782
775
}
783
776
}
784
777
778
+ void _showSnackBar (bool isActive) {
779
+ final snackBar = SnackBar (
780
+ content: Text (isActive
781
+ ? 'Spotify app connection is active (currently playing)'
782
+ : 'Spotify app connection is not active (currently not playing)' ),
783
+ );
784
+
785
+ ScaffoldMessenger .of (context).showSnackBar (snackBar);
786
+ }
787
+
785
788
void setStatus (String code, {String ? message}) {
786
789
var text = message ?? '' ;
787
790
_logger.i ('$code $text ' );
0 commit comments