Skip to content

Commit c17eae5

Browse files
committed
chore(form): address linting issue
1 parent 5ef6a2e commit c17eae5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/src/core/consumed_thing.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ class ConsumedThing implements scripting_api.ConsumedThing {
114114
client = servient.clientFor(scheme);
115115
}
116116

117-
final form = foundForm.resolveUriVariables(options?.uriVariables);
117+
final form =
118+
foundForm.resolveUriVariables(options?.uriVariables) ?? foundForm;
118119

119120
return _ClientAndForm(client, form);
120121
}

lib/src/definitions/form.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ class Form {
301301

302302
/// Resolves all [uriVariables] in this [Form] and creates a copy with an
303303
/// updated [resolvedHref].
304-
Form resolveUriVariables(Map<String, Object>? uriVariables) {
304+
///
305+
/// Returns [Null] if the [href] field does not use any URI variables.
306+
Form? resolveUriVariables(Map<String, Object>? uriVariables) {
305307
final hrefUriVariables = _filterUriVariables(resolvedHref);
306308

307309
// Use global URI variables by default and override them with
@@ -313,7 +315,7 @@ class Form {
313315
if (hrefUriVariables.isEmpty) {
314316
// The href uses no uriVariables, therefore we can abort all further
315317
// checks.
316-
return this;
318+
return null;
317319
}
318320

319321
if (affordanceUriVariables.isEmpty) {

0 commit comments

Comments
 (0)