Skip to content

Commit

Permalink
fixup! chore(examples): add event subscribing to the main example
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Apr 28, 2024
1 parent bfcaccd commit a684b55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Future<void> main(List<String> args) async {
final status = await consumedThing.readProperty("count");
final value = await status.value();
print("New counter value: $value");
await subscription.stop();
}
```

Expand Down
4 changes: 3 additions & 1 deletion example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ Future<void> main(List<String> 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");

final status = await consumedThing.readProperty("count");
final value = await status.value();
print("New counter value: $value");

await subscription.stop();
}

0 comments on commit a684b55

Please sign in to comment.