Skip to content

Commit 457a113

Browse files
authored
Merge pull request #110 from eclipse-thingweb/interactionoutput-dataschemavalue
refactor(InteractionOutput): use DataSchemaValue internally
2 parents 8b0d5be + c279d69 commit 457a113

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/src/core/implementation/interaction_output.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class InteractionOutput implements scripting_api.InteractionOutput {
3434

3535
bool _dataUsed = false;
3636

37-
({bool read, Object? internalValue}) _value =
38-
(read: false, internalValue: null);
37+
scripting_api.DataSchemaValue? _value;
3938

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

4948
@override
5049
Future<Object?> value() async {
51-
if (_value.read) {
52-
return _value.internalValue;
50+
final existingValue = _value;
51+
if (existingValue != null) {
52+
return existingValue.value;
5353
}
5454

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

64-
_value = (read: true, internalValue: value?.value);
64+
_value = value;
6565
return value?.value;
6666
}
6767

0 commit comments

Comments
 (0)