Skip to content

Commit

Permalink
style: prefer double quotes over single quotes for Strings
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 2, 2024
1 parent 5cae848 commit 0d72bf2
Show file tree
Hide file tree
Showing 111 changed files with 2,167 additions and 2,167 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Afterward, the actual interactions with the counter are performed by calling the
`invokeAction()` and `readProperty()` methods on the `ConsumedThing`.

```dart
import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";
Future<void> main(List<String> args) async {
final servient = Servient(
Expand All @@ -59,22 +59,22 @@ Future<void> main(List<String> args) async {
);
final wot = await servient.start();
final url = Uri.parse('coap://plugfest.thingweb.io/counter');
print('Requesting TD from $url ...');
final url = Uri.parse("coap://plugfest.thingweb.io/counter");
print("Requesting TD from $url ...");
final thingDescription = await wot.requestThingDescription(url);
final consumedThing = await wot.consume(thingDescription);
print(
'Successfully retrieved and consumed TD with title '
"Successfully retrieved and consumed TD with title "
'"${thingDescription.title}"!',
);
print('Incrementing counter ...');
await consumedThing.invokeAction('increment');
print("Incrementing counter ...");
await consumedThing.invokeAction("increment");
final status = await consumedThing.readProperty('count');
final status = await consumedThing.readProperty("count");
final value = await status.value();
print('New counter value: $value');
print("New counter value: $value");
}
```

Expand Down
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linter:
rules:
always_use_package_imports: false
prefer_relative_imports: true
prefer_single_quotes: true
prefer_double_quotes: true
sort_constructors_first: true
unawaited_futures: true
public_member_api_docs: true
Expand Down
12 changes: 6 additions & 6 deletions example/coap_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

// ignore_for_file: avoid_print

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

const propertyName = 'string';
const propertyName = "string";

extension PrintExtension on InteractionOutput {
Future<void> printValue() async {
Expand All @@ -23,13 +23,13 @@ Future<void> handleThingDescription(
final consumedThing = await wot.consume(thingDescription);
await consumedThing.writeProperty(
propertyName,
'Hello World'.asInteractionInput(),
"Hello World".asInteractionInput(),
);
var output = await consumedThing.readProperty(propertyName);
await output.printValue();
await consumedThing.writeProperty(
propertyName,
'Bye Value'.asInteractionInput(),
"Bye Value".asInteractionInput(),
);
output = await consumedThing.readProperty(propertyName);
await output.printValue();
Expand All @@ -39,7 +39,7 @@ Future<void> main(List<String> args) async {
final servient = Servient(clientFactories: [CoapClientFactory()]);

final wot = await servient.start();
final uri = Uri.parse('coap://plugfest.thingweb.io:5683/testthing');
final uri = Uri.parse("coap://plugfest.thingweb.io:5683/testthing");

// Example using for-await-loop
try {
Expand All @@ -59,7 +59,7 @@ Future<void> main(List<String> args) async {
(thingDescription) async {
await handleThingDescription(wot, thingDescription);
},
onError: (error) => print('Encountered an error: $error'),
onError: (error) => print("Encountered an error: $error"),
onDone: () => print('Discovery with "listen" has finished.'),
);
}
6 changes: 3 additions & 3 deletions example/coap_dns_sd_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// ignore_for_file: avoid_print

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

void handleThingDescription(ThingDescription thingDescription) =>
print('Discovered TD with title "${thingDescription.title}".');
Expand All @@ -19,7 +19,7 @@ Future<void> main(List<String> args) async {
);

final wot = await servient.start();
final uri = Uri.parse('_wot._udp.local');
final uri = Uri.parse("_wot._udp.local");

// Example using for-await-loop
try {
Expand All @@ -38,7 +38,7 @@ Future<void> main(List<String> args) async {
// to the handleThingDescription function.
wot.discover(uri, method: DiscoveryMethod.dnsServiceDiscovery).listen(
handleThingDescription,
onError: (error) => print('Encountered an error: $error'),
onError: (error) => print("Encountered an error: $error"),
onDone: () => print('Discovery with "listen" has finished.'),
);
}
14 changes: 7 additions & 7 deletions example/coaps_readproperty.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

// ignore_for_file: avoid_print

import 'dart:typed_data';
import "dart:typed_data";

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

/// Matches [PskCredentials] by hostname and URI scheme.
final Map<Uri, PskCredentials> _pskCredentialsStore = {
Uri(host: 'californium.eclipseprojects.io', scheme: 'coaps'): PskCredentials(
identity: Uint8List.fromList('Client_identity'.codeUnits),
preSharedKey: Uint8List.fromList('secretPSK'.codeUnits),
Uri(host: "californium.eclipseprojects.io", scheme: "coaps"): PskCredentials(
identity: Uint8List.fromList("Client_identity".codeUnits),
preSharedKey: Uint8List.fromList("secretPSK".codeUnits),
),
};

Expand All @@ -31,7 +31,7 @@ PskCredentials? _pskCredentialsCallback(
Future<void> main(List<String> args) async {
final CoapClientFactory coapClientFactory = CoapClientFactory(
coapConfig: const CoapConfig(
dtlsCiphers: 'PSK-AES128-CCM8',
dtlsCiphers: "PSK-AES128-CCM8",
),
pskCredentialsCallback: _pskCredentialsCallback,
);
Expand Down Expand Up @@ -70,7 +70,7 @@ Future<void> main(List<String> args) async {

final thingDescription = ThingDescription(thingDescriptionJson);
final consumedThing = await wot.consume(thingDescription);
final status = await consumedThing.readProperty('status');
final status = await consumedThing.readProperty("status");
final value = await status.value();
print(value);
}
32 changes: 16 additions & 16 deletions example/complex_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// ignore_for_file: avoid_print

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

const thingDescriptionJson = '''
{
Expand Down Expand Up @@ -98,7 +98,7 @@ const thingDescriptionJson = '''
''';

final Map<String, BasicCredentials> basicCredentials = {
'urn:test': BasicCredentials('username', 'password'),
"urn:test": BasicCredentials("username", "password"),
};

Future<BasicCredentials?> basicCredentialsCallback(
Expand Down Expand Up @@ -129,51 +129,51 @@ Future<void> main() async {

final thingDescription = ThingDescription(thingDescriptionJson);
final consumedThing = await wot.consume(thingDescription);
final status = await consumedThing.readProperty('status');
final status = await consumedThing.readProperty("status");
final value1 = await status.value();
print(value1);
await consumedThing.invokeAction('toggle');
final status2 = await consumedThing.readProperty('differentStatus');
await consumedThing.invokeAction("toggle");
final status2 = await consumedThing.readProperty("differentStatus");
final value2 = await status2.value();
print(value2);

final status3 = await consumedThing.readProperty(
'anotherStatus',
uriVariables: {'test': 'hi'},
"anotherStatus",
uriVariables: {"test": "hi"},
);
final value3 = await status3.value();
print(value3);

Subscription? subscription;

int observationCounter = 0;
subscription = await consumedThing.observeProperty('status', (data) async {
subscription = await consumedThing.observeProperty("status", (data) async {
if (observationCounter++ == 3) {
print('Done! Cancelling subscription.');
print("Done! Cancelling subscription.");
await subscription?.stop();
}

if (subscription?.active ?? false) {
final value = await data.value();
print('Received observation data: $value');
print("Received observation data: $value");
}
});

await consumedThing.readProperty('test');
await consumedThing.readProperty("test");

final thingUri = Uri.parse(
'https://raw.githubusercontent.com/w3c/wot-testing'
'/b07fa6124bca7796e6ca752a3640fac264d3bcbc/events/2021.03.Online/TDs'
'/Oracle/oracle-Festo_Shared.td.jsonld',
"https://raw.githubusercontent.com/w3c/wot-testing"
"/b07fa6124bca7796e6ca752a3640fac264d3bcbc/events/2021.03.Online/TDs"
"/Oracle/oracle-Festo_Shared.td.jsonld",
);

final thingDiscovery = wot.discover(thingUri);

await for (final thingDescription in thingDiscovery) {
final consumedDiscoveredThing = await wot.consume(thingDescription);
print(
'The title of the fetched TD is '
'${consumedDiscoveredThing.thingDescription.title}.',
"The title of the fetched TD is "
"${consumedDiscoveredThing.thingDescription.title}.",
);
}
}
8 changes: 4 additions & 4 deletions example/core_link_format_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

// ignore_for_file: avoid_print

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

const propertyName = 'status';
const actionName = 'toggle';
const propertyName = "status";
const actionName = "toggle";

Future<void> main(List<String> args) async {
final servient = Servient(clientFactories: [CoapClientFactory()]);
Expand All @@ -19,7 +19,7 @@ Future<void> main(List<String> args) async {
// TODO(JKRhb): Replace with an endpoint providing CoRE Format Links pointing
// to TDs. At the moment, this URI is just for illustrative
// purpose and will not return actual Thing Description links.
final discoveryUri = Uri.parse('coap://coap.me/.well-known/core');
final discoveryUri = Uri.parse("coap://coap.me/.well-known/core");

await for (final thingDescription
in wot.discover(discoveryUri, method: DiscoveryMethod.coreLinkFormat)) {
Expand Down
16 changes: 8 additions & 8 deletions example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// ignore_for_file: avoid_print

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

Future<void> main(List<String> args) async {
final servient = Servient(
Expand All @@ -16,20 +16,20 @@ Future<void> main(List<String> args) async {
);
final wot = await servient.start();

final url = Uri.parse('coap://plugfest.thingweb.io/counter');
print('Requesting TD from $url ...');
final url = Uri.parse("coap://plugfest.thingweb.io/counter");
print("Requesting TD from $url ...");
final thingDescription = await wot.requestThingDescription(url);

final consumedThing = await wot.consume(thingDescription);
print(
'Successfully retrieved and consumed TD with title '
"Successfully retrieved and consumed TD with title "
'"${thingDescription.title}"!',
);

print('Incrementing counter ...');
await consumedThing.invokeAction('increment');
print("Incrementing counter ...");
await consumedThing.invokeAction("increment");

final status = await consumedThing.readProperty('count');
final status = await consumedThing.readProperty("count");
final value = await status.value();
print('New counter value: $value');
print("New counter value: $value");
}
14 changes: 7 additions & 7 deletions example/http_basic_authentication.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

// ignore_for_file: avoid_print

import 'package:dart_wot/dart_wot.dart';
import "package:dart_wot/dart_wot.dart";

const username = 'username';
const password = 'password';
const username = "username";
const password = "password";
const thingDescriptionJson = '''
{
"@context": ["http://www.w3.org/ns/td"],
Expand Down Expand Up @@ -45,10 +45,10 @@ const thingDescriptionJson = '''
}
''';

final basicCredentials = BasicCredentials('username', 'password');
final basicCredentials = BasicCredentials("username", "password");

final Map<String, BasicCredentials> basicCredentialsMap = {
'urn:test': basicCredentials,
"urn:test": basicCredentials,
};

Future<BasicCredentials?> basicCredentialsCallback(
Expand Down Expand Up @@ -80,11 +80,11 @@ Future<void> main(List<String> args) async {

final thingDescription = ThingDescription(thingDescriptionJson);
final consumedThing = await wot.consume(thingDescription);
final status = await consumedThing.readProperty('status');
final status = await consumedThing.readProperty("status");

print(await status.value());

final status2 = await consumedThing.readProperty('status2');
final status2 = await consumedThing.readProperty("status2");

print(await status2.value());
}
Loading

0 comments on commit 0d72bf2

Please sign in to comment.