luxo_client 0.1.1 copy "luxo_client: ^0.1.1" to clipboard
luxo_client: ^0.1.1 copied to clipboard

Luxo SDK for Dart/Flutter — Schema-driven API framework. One .luxo file generates API + DB + SDK. Features: HTTP/2 & WebSocket transport, binary codec (3x faster than JSON), compile-time field selecti [...]

luxo_client #

pub package License

Dart/Flutter SDK for Luxo — a schema-driven API framework with compile-time field selection.

Features #

  • HTTP/2 Transport with JSON and binary modes
  • WebSocket with auto-reconnect (exponential backoff)
  • Binary Codec — varint/svarint/fixed64 encoding, zero-copy field masks
  • 401 Auto-Refresh — token expiry callback with automatic retry
  • Timeout Support — configurable request timeout
  • Code Generation — generate typed client from schema introspection
  • AST Field Tracking — compile-time $select injection via package:analyzer
  • Nested Relations — deep field tracking with depth warnings

Install #

dependencies:
  luxo_client: ^0.1.0

Quick Start #

import 'package:luxo_client/luxo_client.dart';

// Create transport
final transport = HttpTransport(
  'http://localhost:4000/luvia',
  token: 'your-jwt-token',
);

// Make API calls
final result = await transport.call('getUser', {'id': 1});

Code Generation #

Generate a typed client from your running Luxo service:

dart run luxo_client:generate \
  --endpoint http://localhost:4000/luvia \
  --key YOUR_INTROSPECTION_KEY \
  --out lib/src/luxo

This generates:

  • types.dart — typed model classes with binary decoders
  • schema.dart — API schema map for binary transport
  • client.dart — typed client with methods per API
import 'package:your_app/src/luxo/client.dart';

final client = LuxoClient.create(
  'http://localhost:4000/luvia',
  token: 'your-jwt-token',
);

final user = await client.getUser(1);
print(user.name);

final posts = await client.listPosts(page: 1, pageSize: 20);

WebSocket #

final ws = WsTransport(
  'ws://localhost:4000/ws',
  token: 'your-jwt-token',
  autoReconnect: true, // exponential backoff: 1s, 2s, 4s... max 30s
);

ws.onMessage = (data) {
  print('Received: $data');
};

await ws.connect();

Binary Mode #

Switch to binary protocol for production (smaller payloads, faster parsing):

final transport = HttpTransport(
  'http://localhost:4000/luvia',
  mode: TransportMode.binary,
);

Field Tracking (Build Runner) #

Automatically detect which fields your code accesses and inject $select:

# build.yaml
targets:
  $default:
    builders:
      luxo_client|select_hints:
        enabled: true
dart run build_runner build
0
likes
100
points
134
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Luxo SDK for Dart/Flutter — Schema-driven API framework. One .luxo file generates API + DB + SDK. Features: HTTP/2 & WebSocket transport, binary codec (3x faster than JSON), compile-time field selection ($select), typed client codegen, and auto-reconnect.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, glob, http

More

Packages that depend on luxo_client