File tree Expand file tree Collapse file tree 10 files changed +46
-21
lines changed Expand file tree Collapse file tree 10 files changed +46
-21
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ import 'package:dart_wot/dart_wot.dart';
4747
4848Future<void> main(List<String> args) async {
4949 final CoapClientFactory coapClientFactory = CoapClientFactory();
50- final servient = Servient()..addClientFactory(coapClientFactory);
50+ final servient = Servient(
51+ protocolClients: [coapClientFactory]
52+ );
5153 final wot = await servient.start();
5254
5355 final thingDescriptionJson = '''
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ Future<void> handleThingDescription(
3030}
3131
3232Future <void > main (List <String > args) async {
33- final servient = Servient ().. addClientFactory ( CoapClientFactory ());
33+ final servient = Servient (clientFactories : [ CoapClientFactory ()] );
3434
3535 final wot = await servient.start ();
3636 final uri = Uri .parse ('coap://plugfest.thingweb.io:5683/testthing' );
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ void handleThingDescription(ThingDescription thingDescription) =>
1212 print ('Discovered TD with title "${thingDescription .title }".' );
1313
1414Future <void > main (List <String > args) async {
15- final servient = Servient ()..addClientFactory (CoapClientFactory ());
15+ final servient = Servient (
16+ clientFactories: [
17+ CoapClientFactory (),
18+ ],
19+ );
1620
1721 final wot = await servient.start ();
1822 final uri = Uri .parse ('_wot._udp.local' );
Original file line number Diff line number Diff line change @@ -35,7 +35,12 @@ Future<void> main(List<String> args) async {
3535 ),
3636 pskCredentialsCallback: _pskCredentialsCallback,
3737 );
38- final servient = Servient ()..addClientFactory (coapClientFactory);
38+
39+ final servient = Servient (
40+ clientFactories: [
41+ coapClientFactory,
42+ ],
43+ );
3944
4045 final wot = await servient.start ();
4146
Original file line number Diff line number Diff line change @@ -112,15 +112,19 @@ Future<BasicCredentials?> basicCredentialsCallback(
112112}
113113
114114Future <void > main () async {
115- const coapConfig = CoapConfig (blocksize: 64 );
116- final CoapClientFactory coapClientFactory = CoapClientFactory (
117- coapConfig: coapConfig,
115+ final coapClientFactory = CoapClientFactory (
116+ coapConfig: const CoapConfig (blocksize: 64 ),
118117 );
119- final HttpClientFactory httpClientFactory =
118+
119+ final httpClientFactory =
120120 HttpClientFactory (basicCredentialsCallback: basicCredentialsCallback);
121- final servient = Servient ()
122- ..addClientFactory (coapClientFactory)
123- ..addClientFactory (httpClientFactory);
121+
122+ final servient = Servient (
123+ clientFactories: [
124+ coapClientFactory,
125+ httpClientFactory,
126+ ],
127+ );
124128 final wot = await servient.start ();
125129
126130 final thingDescription = ThingDescription (thingDescriptionJson);
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const propertyName = 'status';
1212const actionName = 'toggle' ;
1313
1414Future <void > main (List <String > args) async {
15- final servient = Servient ().. addClientFactory ( CoapClientFactory ());
15+ final servient = Servient (clientFactories : [ CoapClientFactory ()] );
1616
1717 final wot = await servient.start ();
1818
Original file line number Diff line number Diff line change @@ -27,10 +27,15 @@ Future<void> main(List<String> args) async {
2727 final HttpClientFactory httpClientFactory =
2828 HttpClientFactory (basicCredentialsCallback: basicCredentialsCallback);
2929 final MqttClientFactory mqttClientFactory = MqttClientFactory ();
30- final servient = Servient ()
31- ..addClientFactory (coapClientFactory)
32- ..addClientFactory (httpClientFactory)
33- ..addClientFactory (mqttClientFactory);
30+
31+ final servient = Servient (
32+ clientFactories: [
33+ coapClientFactory,
34+ httpClientFactory,
35+ mqttClientFactory,
36+ ],
37+ );
38+
3439 final wot = await servient.start ();
3540
3641 const thingDescriptionJson = '''
Original file line number Diff line number Diff line change @@ -70,7 +70,11 @@ Future<BasicCredentials?> basicCredentialsCallback(
7070Future <void > main (List <String > args) async {
7171 final HttpClientFactory httpClientFactory =
7272 HttpClientFactory (basicCredentialsCallback: basicCredentialsCallback);
73- final servient = Servient ()..addClientFactory (httpClientFactory);
73+ final servient = Servient (
74+ clientFactories: [
75+ httpClientFactory,
76+ ],
77+ );
7478 final wot = await servient.start ();
7579
7680 final thingDescription = ThingDescription (thingDescriptionJson);
Original file line number Diff line number Diff line change @@ -128,13 +128,14 @@ void main() {
128128 ]) async =>
129129 bearerCredentialsStore[uri.host];
130130
131- final servient = Servient ()
132- .. addClientFactory (
131+ final servient = Servient (
132+ clientFactories : [
133133 HttpClientFactory (
134134 basicCredentialsCallback: basicCredentialsCallback,
135135 bearerCredentialsCallback: bearerCredentialsCallback,
136136 ),
137- );
137+ ],
138+ );
138139 final wot = await servient.start ();
139140
140141 final consumedThing = await wot.consume (parsedTd);
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ void main() {
284284
285285 final parsedTd = ThingDescription (thingDescriptionJson);
286286
287- final servient = Servient ().. addClientFactory ( HttpClientFactory ());
287+ final servient = Servient (clientFactories : [ HttpClientFactory ()] );
288288 final wot = await servient.start ();
289289
290290 final uriVariables = {'value' : 'SFRUUEJJTiBpcyBhd2Vzb21l' };
You can’t perform that action at this time.
0 commit comments