Skip to main content

daxle 5.1.0 copy "daxle: ^5.1.0" to clipboard
daxle: ^5.1.0 copied to clipboard

High-performance data modeling, zero-cost map querying, concurrency control, and stream transformations for Dart.

example/example.md

import 'dart:async';
import 'package:daxle/daxle.dart';
import 'package:daxle/async.dart';

void main() async {
  // 1. QueryMap: Zero-cost nested map and embedded list querying
  final payload = {
    'services': {
      'server': {'host': 'https://api.internal', 'port': 8080},
    },
    'users': [
      {'name': 'Alice', 'tags': ['admin', 'dev']},
    ],
  };

  final query = QueryMap(payload);
  final host = query.get<String>('services.server.host'); // 'https://api.internal'
  final firstTag = query.get<String>('users[0].tags[0]'); // 'admin'
  print('Host: $host, First tag: $firstTag');

  // 2. Concurrency: High-performance task pooling
  final tasks = [
    () async => 1,
    () async => 2,
    () async => 3,
  ];

  // Process tasks concurrently in worker batches of 2:
  final batchResult = await const Concurrency.bounded(2).process(tasks);
  print('Batch result: $batchResult'); // [1, 2, 3]

  // 3. Stream Transformation Utilities:
  final controller = StreamController<int>();
  final debounced = controller.stream.debounce(const Duration(milliseconds: 100));

  debounced.listen((event) => print('Debounced event: $event'));
  controller.add(1);
  controller.add(2);
  controller.close();
}
2
likes
160
points
475
downloads

Documentation

API reference

Publisher

verified publishermaranix.in

Weekly Downloads

High-performance data modeling, zero-cost map querying, concurrency control, and stream transformations for Dart.

Repository (GitHub)
View/report issues

Topics

#query-map #concurrency #stream-transform #codegen #utilities

License

MIT (license)

Dependencies

async, meta, pool, stream_transform

More

Packages that depend on daxle