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/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.new({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.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- steamId → String?
-
Steam ID.
final
Methods
-
clearPresence(
) → void - Clears the previously set DiscordPresence for the user.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent 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
Static Methods
-
initialize(
) → void - Initializes the plugin.