diff --git a/pkgs/unified_analytics/lib/src/enums.dart b/pkgs/unified_analytics/lib/src/enums.dart index cb282903..d77b478a 100644 --- a/pkgs/unified_analytics/lib/src/enums.dart +++ b/pkgs/unified_analytics/lib/src/enums.dart @@ -206,8 +206,15 @@ enum DashTool { /// This takes in the string label for a given [DashTool] and returns the /// enum for that string label. - static DashTool? fromLabel(String label) => - DashTool.values.firstWhereOrNull((e) => e.label == label); + static DashTool? fromLabel(String label) { + for (final tool in DashTool.values) { + if (tool.label == label) return tool; + } + + throw Exception('The tool $label from the survey metadata file is not ' + 'a valid DashTool enum value\n' + 'Valid labels for dash tools: ${validDashTools.join(', ')}'); + } } /// Enumerate options for platforms supported. diff --git a/pkgs/unified_analytics/lib/src/survey_handler.dart b/pkgs/unified_analytics/lib/src/survey_handler.dart index 9271977b..b74a33f2 100644 --- a/pkgs/unified_analytics/lib/src/survey_handler.dart +++ b/pkgs/unified_analytics/lib/src/survey_handler.dart @@ -5,7 +5,6 @@ import 'dart:convert'; import 'package:clock/clock.dart'; -import 'package:collection/collection.dart'; import 'package:file/file.dart'; import 'package:http/http.dart' as http;