diff --git a/pkgs/unified_analytics/CHANGELOG.md b/pkgs/unified_analytics/CHANGELOG.md index d139d3e7b..b8ddee461 100644 --- a/pkgs/unified_analytics/CHANGELOG.md +++ b/pkgs/unified_analytics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.4.0 + +- Added the `Event.codeSizeAnalysis` constructor + ## 5.3.0 - User property "host_os_version" added to provide detail version information about the host diff --git a/pkgs/unified_analytics/lib/src/constants.dart b/pkgs/unified_analytics/lib/src/constants.dart index 656565024..28a0e6506 100644 --- a/pkgs/unified_analytics/lib/src/constants.dart +++ b/pkgs/unified_analytics/lib/src/constants.dart @@ -82,7 +82,7 @@ const int kLogFileLength = 2500; const String kLogFileName = 'dart-flutter-telemetry.log'; /// The current version of the package, should be in line with pubspec version. -const String kPackageVersion = '5.3.0'; +const String kPackageVersion = '5.4.0'; /// The minimum length for a session. const int kSessionDurationMinutes = 30; diff --git a/pkgs/unified_analytics/lib/src/enums.dart b/pkgs/unified_analytics/lib/src/enums.dart index 9a87d8785..18dc190cc 100644 --- a/pkgs/unified_analytics/lib/src/enums.dart +++ b/pkgs/unified_analytics/lib/src/enums.dart @@ -46,6 +46,11 @@ enum DashEvent { // Events for the Flutter CLI + codeSizeAnalysis( + label: 'code_size_analysis', + description: 'Indicates when the "--analyize-size" command is run', + toolOwner: DashTool.flutterTool, + ), doctorValidatorResult( label: 'doctor_validator_result', description: 'Results from a specific doctor validator', diff --git a/pkgs/unified_analytics/lib/src/event.dart b/pkgs/unified_analytics/lib/src/event.dart index 5edd8c458..06b445ece 100644 --- a/pkgs/unified_analytics/lib/src/event.dart +++ b/pkgs/unified_analytics/lib/src/event.dart @@ -110,6 +110,17 @@ final class Event { if (removed != null) 'removed': removed, }; + /// An event that reports when the code size measurement is run + /// via `--analyze-size`. + /// + /// [platform] - string identifier for which platform was run "ios", "apk", + /// "aab", etc. + Event.codeSizeAnalysis({required String platform}) + : eventName = DashEvent.codeSizeAnalysis, + eventData = { + 'platform': platform, + }; + /// Event that is emitted periodically to report the number of times a given /// command has been executed. /// diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index fc08e1d7c..6582fb33a 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -4,7 +4,7 @@ description: >- to Google Analytics. # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. -version: 5.3.0 +version: 5.4.0 repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics environment: diff --git a/pkgs/unified_analytics/test/event_test.dart b/pkgs/unified_analytics/test/event_test.dart index 0ce7b1ef9..9cb3488a7 100644 --- a/pkgs/unified_analytics/test/event_test.dart +++ b/pkgs/unified_analytics/test/event_test.dart @@ -398,6 +398,17 @@ void main() { expect(constructedEvent.eventData.length, 3); }); + test('Event.codeSizeAnalysis constructed', () { + Event generateEvent() => Event.codeSizeAnalysis(platform: 'platform'); + + final constructedEvent = generateEvent(); + + expect(generateEvent, returnsNormally); + expect(constructedEvent.eventName, DashEvent.codeSizeAnalysis); + expect(constructedEvent.eventData['platform'], 'platform'); + expect(constructedEvent.eventData.length, 1); + }); + test('Confirm all constructors were checked', () { var constructorCount = 0; for (var declaration in reflectClass(Event).declarations.keys) { @@ -406,7 +417,7 @@ void main() { // Change this integer below if your PR either adds or removes // an Event constructor - final eventsAccountedForInTests = 20; + final eventsAccountedForInTests = 21; expect(eventsAccountedForInTests, constructorCount, reason: 'If you added or removed an event constructor, ' 'ensure you have updated '