Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't ping server #8

Open
maniakovsky opened this issue Jan 18, 2023 · 1 comment
Open

Can't ping server #8

maniakovsky opened this issue Jan 18, 2023 · 1 comment

Comments

@maniakovsky
Copy link

maniakovsky commented Jan 18, 2023

void getServer() async {
    final server = await ping('mc.hypixel.net');
    if (server == null || server.response == null) return;
    final players = server.response!.players;
    if (kDebugMode) {
      print('Pinged ...');
    }
    if (kDebugMode) {
      print('${players.online} / ${players.max}. ${server.ping}ms.');
    }
    setState(() {
      playersOnline = players;
    });
  }

Error: Unsupported operation: dart:io is required to ping servers.

Even when i import dart:io, it still doesnt work

@spnda
Copy link
Owner

spnda commented Jan 31, 2023

Are you trying to compile to JavaScript? The current ping implementation only works on native and not on JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants