|
6 | 6 |
|
7 | 7 | // ignore_for_file: avoid_print |
8 | 8 |
|
9 | | -import 'package:dart_wot/dart_wot.dart'; |
| 9 | +import "package:dart_wot/dart_wot.dart"; |
10 | 10 |
|
11 | 11 | const thingDescriptionJson = ''' |
12 | 12 | { |
@@ -98,7 +98,7 @@ const thingDescriptionJson = ''' |
98 | 98 | '''; |
99 | 99 |
|
100 | 100 | final Map<String, BasicCredentials> basicCredentials = { |
101 | | - 'urn:test': BasicCredentials('username', 'password'), |
| 101 | + "urn:test": BasicCredentials("username", "password"), |
102 | 102 | }; |
103 | 103 |
|
104 | 104 | Future<BasicCredentials?> basicCredentialsCallback( |
@@ -129,51 +129,51 @@ Future<void> main() async { |
129 | 129 |
|
130 | 130 | final thingDescription = ThingDescription(thingDescriptionJson); |
131 | 131 | final consumedThing = await wot.consume(thingDescription); |
132 | | - final status = await consumedThing.readProperty('status'); |
| 132 | + final status = await consumedThing.readProperty("status"); |
133 | 133 | final value1 = await status.value(); |
134 | 134 | print(value1); |
135 | | - await consumedThing.invokeAction('toggle'); |
136 | | - final status2 = await consumedThing.readProperty('differentStatus'); |
| 135 | + await consumedThing.invokeAction("toggle"); |
| 136 | + final status2 = await consumedThing.readProperty("differentStatus"); |
137 | 137 | final value2 = await status2.value(); |
138 | 138 | print(value2); |
139 | 139 |
|
140 | 140 | final status3 = await consumedThing.readProperty( |
141 | | - 'anotherStatus', |
142 | | - uriVariables: {'test': 'hi'}, |
| 141 | + "anotherStatus", |
| 142 | + uriVariables: {"test": "hi"}, |
143 | 143 | ); |
144 | 144 | final value3 = await status3.value(); |
145 | 145 | print(value3); |
146 | 146 |
|
147 | 147 | Subscription? subscription; |
148 | 148 |
|
149 | 149 | int observationCounter = 0; |
150 | | - subscription = await consumedThing.observeProperty('status', (data) async { |
| 150 | + subscription = await consumedThing.observeProperty("status", (data) async { |
151 | 151 | if (observationCounter++ == 3) { |
152 | | - print('Done! Cancelling subscription.'); |
| 152 | + print("Done! Cancelling subscription."); |
153 | 153 | await subscription?.stop(); |
154 | 154 | } |
155 | 155 |
|
156 | 156 | if (subscription?.active ?? false) { |
157 | 157 | final value = await data.value(); |
158 | | - print('Received observation data: $value'); |
| 158 | + print("Received observation data: $value"); |
159 | 159 | } |
160 | 160 | }); |
161 | 161 |
|
162 | | - await consumedThing.readProperty('test'); |
| 162 | + await consumedThing.readProperty("test"); |
163 | 163 |
|
164 | 164 | final thingUri = Uri.parse( |
165 | | - 'https://raw.githubusercontent.com/w3c/wot-testing' |
166 | | - '/b07fa6124bca7796e6ca752a3640fac264d3bcbc/events/2021.03.Online/TDs' |
167 | | - '/Oracle/oracle-Festo_Shared.td.jsonld', |
| 165 | + "https://raw.githubusercontent.com/w3c/wot-testing" |
| 166 | + "/b07fa6124bca7796e6ca752a3640fac264d3bcbc/events/2021.03.Online/TDs" |
| 167 | + "/Oracle/oracle-Festo_Shared.td.jsonld", |
168 | 168 | ); |
169 | 169 |
|
170 | 170 | final thingDiscovery = wot.discover(thingUri); |
171 | 171 |
|
172 | 172 | await for (final thingDescription in thingDiscovery) { |
173 | 173 | final consumedDiscoveredThing = await wot.consume(thingDescription); |
174 | 174 | print( |
175 | | - 'The title of the fetched TD is ' |
176 | | - '${consumedDiscoveredThing.thingDescription.title}.', |
| 175 | + "The title of the fetched TD is " |
| 176 | + "${consumedDiscoveredThing.thingDescription.title}.", |
177 | 177 | ); |
178 | 178 | } |
179 | 179 | } |
0 commit comments