๐Ÿ“„ README.md

# Steam RCON ๐ŸŽฎ

A Dart implementation of the Source RCON protocol for communicating with game servers such as those based on Source Engine or Palworld.

Supports:
โœ… Authentication
โœ… Sending RCON commands
โœ… Automatic reconnection on network loss
โœ… Live network monitoring with connectivity_plus
โœ… Command retry on disconnect

---

## ๐Ÿš€ Getting Started

### ๐Ÿ“ฆ Installation

Add the following to your `pubspec.yaml`:

```yaml
dependencies:
  steam-rcon: ^1.0.3

Or use a local path during development:

dependencies:
  rcon:
    path: ../steam-rcon

Then run:

dart pub get

๐Ÿ”Œ Basic Usage

import 'package:steam-rcon/rcon.dart';

void main() async {
  final client = RconClient('127.0.0.1', port: 25575);

  await client.connect();

  final authenticated = await client.authenticate('your_rcon_password');
  if (!authenticated) {
    print('โŒ Authentication failed');
    return;
  }

  final response = await client.sendCommand('status');
  print('๐Ÿ“ก Server response: $response');

  client.disconnect();
}

๐Ÿ“ก Features

  • Handles full Source RCON protocol (ID, type, null-terminated strings)
  • Automatic reconnect if connection drops
  • Auto-resend of last command after reconnection
  • Network change detection with connectivity_plus
  • Typed packet decoding and encoding
  • Easy-to-use API for Flutter or Dart CLI

๐Ÿ“ Project Structure

  • rcon_client.dart: Manages connection, authentication, reconnection and command sending.
  • rcon_packet.dart: Handles packet encoding/decoding according to the Valve Source RCON protocol.

๐Ÿ›  Example: Using in Flutter

You can use this in a Flutter app to build an RCON admin panel. For example:

final rcon = RconClient("192.168.0.100", port: 25575);
await rcon.connect();
await rcon.authenticate("your_password");
final players = await rcon.sendCommand("ShowPlayers");
print(players);

๐Ÿ“„ License

BSD 3-clause ยฉ Matthias Prรถll


โค๏ธ Contributing

Pull requests are welcome! If you want to help improve the package, feel free to fork it and send a PR.