0 purchases
dart discord rpc
dart_discord_rpc
Discord Rich Presence for Flutter & Dart apps & games.
Install #
Flutter
dependencies:
..
dart_discord_rpc: ^0.0.1
copied to clipboard
Dart CLI
dependencies:
..
dart_discord_rpc_ffi: ^0.0.1
copied to clipboard
Documentation #
For integrating Discord Rich Presence into your application or game, you must create an application at Discord Developer Portal.
Initialize the plugin.
void main() {
DiscordRPC.initialize();
runApp(MyApp());
}
copied to clipboard
Instantiate class.
DiscordRPC rpc = DiscordRPC(
applicationId: 'APPLICATION_ID',
);
copied to clipboard
Set or change the user presence.
rpc.start(autoRegister: true);
rpc.updatePresence(
DiscordPresence(
state: 'Discord Rich Presence from Dart. 🎯',
details: 'github.com/alexmercerind/dart_discord_rpc',
startTimeStamp: DateTime.now().millisecondsSinceEpoch,
largeImageKey: 'large_image',
largeImageText: 'This text describes the large image.',
smallImageKey: 'small_image',
smallImageText: 'This text describes the small image.',
),
);
copied to clipboard
Clear the user presence.
rpc.clearPresence();
copied to clipboard
Listen to the events.
rpc.events.listen((event) {
if (event is DiscordReady) {
event.user;
}
if (event is DiscordErrored) {
event.errorCode;
event.message;
}
if (event is DiscordJoinGame) {
event.joinSecret;
}
// Other events.
});
copied to clipboard
There are other features for you to checkout.
Support #
Consider supporting the project by starring the repository or buying me a coffee.
License #
Copyright (c) 2021 Hitesh Kumar Saini [email protected]
MIT. Contributions welcomed.
Platforms #
Supported
Windows
Coming Soon
Linux
Android
Unsupported
macOS
iOS
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.