DiscordRPC class

Discord Rich Presence for Dart & Flutter.

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());
}

Example

var rpc = DiscordRPC(
  applicationId: '877853131025809438',
);
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.',
  ),
);
Inheritance
  • Object
  • DiscordRPC
  • DiscordRPC

Constructors

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

Properties

applicationId → String
ID of your application at Discord Developer Portal.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
steamId → String?
Steam ID.
finalinherited

Methods

clearPresence() → void
Clears the previously set DiscordPresence for the user.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(String command) → void
Registers the rich presence client.
inherited
registerSteamGame() → void
Registers the steam game.
inherited
respond(String userId, int reply) → void
Responds to the user.
inherited
shutDown() → void
Shuts down the Discord RPC.
inherited
start({bool autoRegister = false}) → void
Starts the Discord Rich Presence.
inherited
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.
inherited

Operators

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

Static Methods

initialize() → void
Initializes the plugin.