Skip to content

Commit

Permalink
fix analyze issues
Browse files Browse the repository at this point in the history
  • Loading branch information
brim-borium committed Oct 3, 2024
1 parent b23cbbb commit d979616
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class HomeState extends State<Home> {
lineLength: 120, // width of the output
colors: true, // Colorful log messages
printEmojis: true, // Print an emoji for each log message
printTime: true,
),
);

Expand Down Expand Up @@ -767,21 +766,25 @@ class HomeState extends State<Home> {

Future<void> checkIfAppIsActive(BuildContext context) async {
try {
await SpotifySdk.isSpotifyAppActive.then((isActive) {
final snackBar = SnackBar(
content: Text(isActive
? 'Spotify app connection is active (currently playing)'
: 'Spotify app connection is not active (currently not playing)'));

ScaffoldMessenger.of(context).showSnackBar(snackBar);
});
final isActive = await SpotifySdk.isSpotifyAppActive;
_showSnackBar(isActive);
} on PlatformException catch (e) {
setStatus(e.code, message: e.message);
} on MissingPluginException {
setStatus('not implemented');
}
}

void _showSnackBar(bool isActive) {
final snackBar = SnackBar(
content: Text(isActive
? 'Spotify app connection is active (currently playing)'
: 'Spotify app connection is not active (currently not playing)'),
);

ScaffoldMessenger.of(context).showSnackBar(snackBar);
}

void setStatus(String code, {String? message}) {
var text = message ?? '';
_logger.i('$code$text');
Expand Down
2 changes: 1 addition & 1 deletion lib/spotify_sdk_web.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@JS()
library spotify_sdk_web;
library;

import 'dart:async';
import 'dart:convert';
Expand Down

0 comments on commit d979616

Please sign in to comment.