Skip to content

Install

Two packages. Which you want depends on whether a widget tree is involved.

Terminal window
dart pub add ahp_sdk
import 'package:ahp_sdk/ahp_sdk.dart';

One import gets everything: the generated protocol types, the reducers, the reconciliation engine, the transport, and the runtime. There are no secondary entry points to remember.

Terminal window
flutter pub add ahp_flutter
import 'package:ahp_flutter/ahp_flutter.dart';

The bindings re-export the whole SDK, so this is the only import a Flutter app needs — adding ahp_sdk alongside it is redundant.

Two names are withheld from that re-export, because Flutter already defines them and the collision would be silent:

Withheld Why
Icon Material’s Icon widget
TextSelection dart:ui’s TextSelection

Reach them through a prefixed import when you need the protocol’s versions:

import 'package:ahp_sdk/ahp_sdk.dart' as ahp;
final icon = ahp.Icon(/* ... */);
Dart SDK ^3.9.0
Runtime dependency web_socket_channel

The Dart 3.9 floor is not arbitrary. The generated codecs use null-aware elements ('key': ?value) throughout, which is what lets an absent optional field be omitted from a JSON map rather than written as an explicit null — and that distinction is exactly what the round-trip fixtures assert.

The package ships an executable that connects to a live host and prints what it mirrors back:

Terminal window
dart run ahp_sdk:ahp --url ws://localhost:51234

See The CLI for what it does and how to read its output.

On macOS, a sandboxed app needs the network-client entitlement or the WebSocket will fail to open with no useful diagnostic:

<key>com.apple.security.network.client</key>
<true/>

Add it to both DebugProfile.entitlements and Release.entitlements.