From c279d69bd8e6d0ae13bf3d555852e0a71d1a4ffc Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Sat, 27 Jan 2024 21:48:53 +0100 Subject: [PATCH] refactor(InteractionOutput): use DataSchemaValue internally --- lib/src/core/implementation/interaction_output.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/core/implementation/interaction_output.dart b/lib/src/core/implementation/interaction_output.dart index 01f9d63b..7c202d46 100644 --- a/lib/src/core/implementation/interaction_output.dart +++ b/lib/src/core/implementation/interaction_output.dart @@ -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 arrayBuffer() async { @@ -48,8 +47,9 @@ class InteractionOutput implements scripting_api.InteractionOutput { @override Future 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? @@ -61,7 +61,7 @@ class InteractionOutput implements scripting_api.InteractionOutput { ); _dataUsed = true; - _value = (read: true, internalValue: value?.value); + _value = value; return value?.value; }