discord_rpc 0.0.2 discord_rpc: ^0.0.2 copied to clipboard
Discord Rich Presence for Flutter & Dart apps & games. Updated ffi version.
import 'package:flutter/material.dart';
import 'package:discord_rpc/discord_rpc.dart';
void main() {
DiscordRPC.initialize();
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
DiscordRPC discord = DiscordRPC(
applicationId: '877853131025809438',
);
@override
void initState() {
super.initState();
discord.start(autoRegister: true);
discord.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.',
),
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('discord_rpc'),
),
body: Center(
child: Text('Open Discord to see the plugin working.'),
),
),
);
}
}