mercure_client 0.0.2 copy "mercure_client: ^0.0.2" to clipboard
mercure_client: ^0.0.2 copied to clipboard

outdated

Provide a quick way to publish and consume messages on Mercure

example/mercure_client_example.dart

import 'package:mercure_client/mercure_client.dart';

void main() {
  final events = <MercureEvent>[];

  final mercure = Mercure(
    'http://example.com/.well-known/mercure', // your mercure hub url
    '/books/{id}', // your mercure topic
  );

  mercure.subscribe(events.add);

  /// Publish message to the hub
  // ignore: unused_element
  Future<void> publisher(Book book) async {
    await Mercure.publish<Book>(
      url: 'http://example.com/.well-known/mercure',
      topic: '/books',
      data: book.toString(),
    );
  }
}

class Book {
  Book(this.title);

  final String title;
}
12
likes
0
points
221
downloads

Publisher

verified publisherherve-guigoz.com

Weekly Downloads

Provide a quick way to publish and consume messages on Mercure

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, meta

More

Packages that depend on mercure_client