diff --git a/lib/services/nt_connection.dart b/lib/services/nt_connection.dart index 7730f8db..19738e92 100644 --- a/lib/services/nt_connection.dart +++ b/lib/services/nt_connection.dart @@ -155,11 +155,7 @@ class NTConnection { } Object? getLastAnnouncedValue(String topic) { - if (_ntClient.lastAnnouncedValues.containsKey(topic)) { - return _ntClient.lastAnnouncedValues[topic]; - } - - return null; + return _ntClient.lastAnnouncedValues[topic]; } void unpublishTopic(NT4Topic topic) { diff --git a/lib/widgets/nt_widgets/multi-topic/field_widget.dart b/lib/widgets/nt_widgets/multi-topic/field_widget.dart index e7391a0d..942f7aec 100644 --- a/lib/widgets/nt_widgets/multi-topic/field_widget.dart +++ b/lib/widgets/nt_widgets/multi-topic/field_widget.dart @@ -382,7 +382,7 @@ class FieldWidget extends NTWidget { List currentData = getCurrentData(); - if (!(const DeepCollectionEquality().equals(previousData, currentData))) { + if (!NTWidget.listEquals(previousData, currentData)) { yield Object(); previousData = currentData; } else if (!rendered) { diff --git a/lib/widgets/nt_widgets/nt_widget.dart b/lib/widgets/nt_widgets/nt_widget.dart index 63c050e6..638ed0e5 100644 --- a/lib/widgets/nt_widgets/nt_widget.dart +++ b/lib/widgets/nt_widgets/nt_widget.dart @@ -168,6 +168,8 @@ abstract class NTWidget extends StatelessWidget { }); } + static final Function listEquals = const DeepCollectionEquality().equals; + @protected List getCurrentData() { return []; @@ -180,7 +182,7 @@ abstract class NTWidget extends StatelessWidget { while (true) { List currentData = getCurrentData(); - if (!(const DeepCollectionEquality().equals(previousData, currentData))) { + if (!listEquals(previousData, currentData)) { yield Object(); previousData = currentData; }