DiscordRPC class Null safety

Discord Rich Presence

For integrating Discord Rich Presence into your application or game, you must create an application at Discord Developer Portal.

Example


void main() {
  DiscordRPC.initialize();
  runApp(MyApp());
}

DiscordRPC discord = DiscordRPC(
  applicationId: '877853131025809438',
);
discord.start(autoRegister: true);
discord.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.',
  ),
);

Constructors

DiscordRPC({required DynamicLibrary dynamicLibrary, required String applicationId, String? steamId})

Properties

applicationId String
ID of your application at Discord Developer Portal.
final
hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
steamId String?
Steam ID.
final

Methods

clearPresence() → void
Clears the previously set DiscordPresence for the user.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
register(String command) → void
Registers the rich presence client.
registerSteamGame() → void
Registers the steam game.
respond(String userId, int reply) → void
Responds to the user.
shutDown() → void
Shuts down the Discord RPC.
start({bool autoRegister = false}) → void
Starts the Discord Rich Presence.
toString() String
A string representation of this object.
inherited
updatePresence(DiscordPresence presence) → void
Updates the presence of the DiscordUser, takes DiscordPresence as argument. Describing current user presence inside the application or game.

Operators

operator ==(Object other) bool
The equality operator.
inherited