From 927241c84c36c083ad0879802d1dd12df546c4eb Mon Sep 17 00:00:00 2001 From: Kenzie Davisson Date: Fri, 8 Nov 2024 10:12:35 -0800 Subject: [PATCH] more comments --- pkgs/unified_analytics/lib/src/event.dart | 8 +++----- pkgs/unified_analytics/test/event_test.dart | 8 +------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pkgs/unified_analytics/lib/src/event.dart b/pkgs/unified_analytics/lib/src/event.dart index fb773ea1..cf6f84f9 100644 --- a/pkgs/unified_analytics/lib/src/event.dart +++ b/pkgs/unified_analytics/lib/src/event.dart @@ -411,9 +411,7 @@ final class Event { if (ideLaunchedFeature != null) 'ideLaunchedFeature': ideLaunchedFeature, if (isWasm != null) 'isWasm': isWasm, - if (additionalMetrics != null) - ...additionalMetrics.toMap() - ..removeWhere((key, value) => value == null), + if (additionalMetrics != null) ...additionalMetrics.toMap(), }; /// Event that contains the results for a specific doctor validator. @@ -856,7 +854,7 @@ final class Event { /// allows custom metrics to be added by a unified_analytics client. abstract base class CustomMetrics { /// Converts the custom metrics data to a [Map] object. - /// + /// /// This must be a JSON encodable [Map]. - Map toMap(); + Map toMap(); } diff --git a/pkgs/unified_analytics/test/event_test.dart b/pkgs/unified_analytics/test/event_test.dart index 651359cc..70b0959b 100644 --- a/pkgs/unified_analytics/test/event_test.dart +++ b/pkgs/unified_analytics/test/event_test.dart @@ -579,9 +579,6 @@ void main() { isWasm: 'true', additionalMetrics: _TestMetrics( stringField: 'test', - // Since this value is null, it should not be included in the event - // JSON below. - nullableField: null, intField: 100, boolField: false, ), @@ -692,20 +689,17 @@ void main() { final class _TestMetrics extends CustomMetrics { _TestMetrics({ required this.stringField, - required this.nullableField, required this.intField, required this.boolField, }); final String stringField; - final String? nullableField; final int intField; final bool boolField; @override - Map toMap() => { + Map toMap() => { 'stringField': stringField, - 'nullableField': nullableField, 'intField': intField, 'boolField': boolField, };