I'm currently trying to make a website that reads and displays data from discord. This should be realised in Flutter. I have chosen the library nyxx to create the discord connection.
I have the problem that as soon as I want to establish the Discord bot client connection in a widget or the main function, the page/application no longer loads (regardless of whether the widget is loaded or not). How can I fix this? Or are there other ways to achieve this?
The Code I have to test the connection in The Main Page:
class Home extends StatefulWidget {
const Home({super.key});
@override
State<StatefulWidget> createState() => _HomeState();
}
class _HomeState extends State<Home> {
List<bool> isSelected = [false, true, true, true, true];
@override
void initState() {
super.initState();
initDiscord();
}
@override
Widget build(BuildContext context) {
...
}
Future<void> initDiscord() async {
final client = await Nyxx.connectGateway(
Secrets.DiscordToken,
GatewayIntents.allUnprivileged,
options: GatewayClientOptions(plugins: [logging, cliIntegration]),
);
}
}
The Problem was, that the discord Api blocks calls from web.