bolt_udp_binding 0.1.0-dev.2 copy "bolt_udp_binding: ^0.1.0-dev.2" to clipboard
bolt_udp_binding: ^0.1.0-dev.2 copied to clipboard

Provides bi-directional UDP Bindings for Bolt

bolt logo

Provides bi-directional UDP Bindings for Bolt

pub package bolt coverage style: very good analysis License: MIT


Quick Start 🚀 #

Prerequisites 📝 #

In order to start using the UDP bindings for Bolt you must have the Dart SDK installed on your machine.

Installing 🧑‍💻 #

Add bolt_udp_binding to your pubspec.yaml:

# 📦 Install bolt_udp_binding from pub.dev
dart pub add bolt_udp_binding

Add the binding to a Server 🏁 #

Add the UdpBinding to the list of bindings of your server:

import 'package:bolt/bolt.dart';
import 'package:bolt/server.dart';
import 'package:bolt_udp_binding/bolt_udp_binding.dart';

class ExampleServer extends BoltServer {
  ExampleServer(
    Address address, {
    super.logger,
  }) : super(bindings: [UdpBinding(address, logger: logger)]);

  ...

}

Add the binding to a Client ✨ #

Pass the UdpBinding to the binding of your client:

import 'package:bolt/bolt.dart';
import 'package:bolt/client.dart';
import 'package:bolt_udp_binding/bolt_udp_binding.dart';

class ExampleClient extends BoltClient {
  ExampleClient({
    super.logger,
    required super.server,
  }) : super(binding: UdpBinding(server, logger: logger));

  ...

}