Skip to content

Commit

Permalink
refactor(InteractionOutput): use DataSchemaValue internally
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 20, 2024
1 parent afab954 commit d3eddd7
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;
}

if (schema == null) {
Expand All @@ -65,7 +65,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 d3eddd7

Please sign in to comment.