From a684b55d6dfd189cfa513ca59774b3ccde3876f7 Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Mon, 29 Apr 2024 00:05:49 +0200 Subject: [PATCH] fixup! chore(examples): add event subscribing to the main example --- README.md | 2 ++ example/example.dart | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 087019b0..e4803ac9 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,8 @@ Future main(List args) async { final status = await consumedThing.readProperty("count"); final value = await status.value(); print("New counter value: $value"); + + await subscription.stop(); } ``` diff --git a/example/example.dart b/example/example.dart index 23dc2adb..edf73ef8 100644 --- a/example/example.dart +++ b/example/example.dart @@ -30,7 +30,7 @@ Future main(List args) async { ); print(consumedThing.thingDescription.events); - await consumedThing.subscribeEvent("change", print); + final subscription = await consumedThing.subscribeEvent("change", print); print("Incrementing counter ..."); await consumedThing.invokeAction("increment"); @@ -38,4 +38,6 @@ Future main(List args) async { final status = await consumedThing.readProperty("count"); final value = await status.value(); print("New counter value: $value"); + + await subscription.stop(); }