Skip to content

Commit

Permalink
Merge pull request #110 from eclipse-thingweb/interactionoutput-datas…
Browse files Browse the repository at this point in the history
…chemavalue

refactor(InteractionOutput): use DataSchemaValue internally
  • Loading branch information
JKRhb authored Jan 27, 2024
2 parents 8b0d5be + c279d69 commit 457a113
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/core/implementation/interaction_output.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class InteractionOutput implements scripting_api.InteractionOutput {

bool _dataUsed = false;

({bool read, Object? internalValue}) _value =
(read: false, internalValue: null);
scripting_api.DataSchemaValue? _value;

@override
Future<ByteBuffer> arrayBuffer() async {
Expand All @@ -48,8 +47,9 @@ class InteractionOutput implements scripting_api.InteractionOutput {

@override
Future<Object?> value() async {
if (_value.read) {
return _value.internalValue;
final existingValue = _value;
if (existingValue != null) {
return existingValue.value;
}

// TODO(JKRhb): Should a NotReadableError be thrown if schema is null?
Expand All @@ -61,7 +61,7 @@ class InteractionOutput implements scripting_api.InteractionOutput {
);
_dataUsed = true;

_value = (read: true, internalValue: value?.value);
_value = value;
return value?.value;
}

Expand Down

0 comments on commit 457a113

Please sign in to comment.