music_assistant 0.1.0 copy "music_assistant: ^0.1.0" to clipboard
music_assistant: ^0.1.0 copied to clipboard

Dart client for using working with the Music Assistant Websocket API from Dart and Flutter applications

Dart Client for Music Assistant #

Dart client for using working with the Music Assistant Websocket API from Dart and Flutter applications.

Example Usage #

import 'package:music_assistant/music_assistant.dart';

void main() async {
  // Create a client instance, pull url and token from env variables
  final client = MusicAssistantClient('http://localhost:8095', 'your_token_here');

  try {
    // Connect to the server and authenticate
    await client.connect();

    // Fetch initial state for all endpoints (players, player queues, etc.)
    await client.fetchState();

    // Print all players
    print('Players:');
    for (final player in client.players.all.values) {
      print('- ${player.name} (ID: ${player.playerId})');
    }
  } finally {
    // Disconnect from the server when done
    await client.disconnect();
  }
}

Supported Commands #

This library supports a subset of the Music Assistant API commands, but aims to be in-line with the official Python client. The following endpoints are currently supported:

  • ❌ auth
  • ❌ config
  • ❌ metadata
  • ❌ music
  • ❌ party
  • ✅ player_queues
  • ✅ players
  • ❌ providers
  • ❌ remote_access
  • ❌ tasks

Rebuilding Models #

The models in this library are generated using json_serializable. If you make changes to the models, you can rebuild the generated code using the following command:

dart run build_runner build
dart format lib/src/**/*.g.dart
1
likes
160
points
8
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart client for using working with the Music Assistant Websocket API from Dart and Flutter applications

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

async, json_annotation, logging, uuid, web_socket_channel

More

Packages that depend on music_assistant