dart_plex 0.0.2 copy "dart_plex: ^0.0.2" to clipboard
dart_plex: ^0.0.2 copied to clipboard

Dart client for Plex Media Server. Supports authentication, library browsing, playlists, streaming, search and more. Targets macOS, Windows, Linux, iOS and Android.

example/dart_plex_example.dart

// Copyright © 2026 & onwards, Alessandro Di Ronza <ales.drnz@gmail.com>.
// All rights reserved.
// Use of this source code is governed by BSD 3-Clause license that can be found in the LICENSE file.

import 'package:dart_plex/dart_plex.dart';

Future<void> main() async {
  final plex = PlexClient(
    credentials: const PlexCredentials(
      clientIdentifier: 'example-client-id',
      product: 'MyApp',
      version: '1.0.0',
      device: 'CLI',
      deviceName: 'example',
      platform: 'macOS',
    ),
  );

  await plex.account.signInWithPassword(
    username: 'user',
    password: 'password',
  );

  final resources = await plex.account.fetchResources();
  final server = resources.firstWhere((r) => r.owned && r.isServer);
  final connection = server.bestConnection();
  if (connection == null) {
    print('No reachable connection for ${server.name}');
    return;
  }
  plex.connect(connection.uri, accessToken: server.accessToken);

  final sections = await plex.library.sections();
  for (final s in sections) {
    print('${s.title} (${s.type})');
  }
}
4
likes
160
points
103
downloads
screenshot

Documentation

API reference

Publisher

verified publisherales-drnz.com

Weekly Downloads

Dart client for Plex Media Server. Supports authentication, library browsing, playlists, streaming, search and more. Targets macOS, Windows, Linux, iOS and Android.

Repository (GitHub)
View/report issues

Topics

#plex #media-server #music #streaming #api-client

License

BSD-3-Clause (license)

Dependencies

dio, meta, web_socket_channel

More

Packages that depend on dart_plex