Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexmercerind/dart_discord_rpc
Discord Rich Presence for Flutter & Dart.
https://github.com/alexmercerind/dart_discord_rpc
dart discord discord-rpc flutter
Last synced: 8 days ago
JSON representation
Discord Rich Presence for Flutter & Dart.
- Host: GitHub
- URL: https://github.com/alexmercerind/dart_discord_rpc
- Owner: alexmercerind
- License: mit
- Created: 2021-08-19T14:35:15.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-02T03:34:36.000Z (6 months ago)
- Last Synced: 2024-10-19T08:17:06.444Z (20 days ago)
- Topics: dart, discord, discord-rpc, flutter
- Language: C++
- Homepage:
- Size: 811 KB
- Stars: 34
- Watchers: 1
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
dart_discord_rpc
Discord Rich Presence for Flutter & Dart apps & games.
## Install
**Flutter**
`flutter pub add dart_discord_rpc`
**Dart CLI**
`dart pub add dart_discord_rpc`
## Documentation
For integrating Discord Rich Presence into your application or game, you must create an application at [Discord Developer Portal](https://discord.com/developers/applications).
**Initialize the plugin.**
```dart
void main() {
DiscordRPC.initialize();
runApp(MyApp());
}
```**Instantiate class.**
```dart
DiscordRPC rpc = DiscordRPC(
applicationId: 'APPLICATION_ID',
);
```**Set or change the user presence.**
```dart
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.',
),
);
```**Clear the user presence.**
```dart
rpc.clearPresence();
```**Listen to the events.**
```dart
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.
});
```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
MIT. Contributions welcomed.
See [COPYRIGHT](https://github.com/alexmercerind/dart_discord_rpc/blob/master/COPYRIGHT) for comprehensive licensing information.
## Platforms
Supported
- Windows
- Linux