@@ -126,8 +126,10 @@ abstract class Analytics {
126126 // Ensure that the home directory has permissions enabled to write
127127 final homeDirectory = getHomeDirectory (fs);
128128 if (homeDirectory == null ) {
129- throw Exception ('Unable to determine the home directory, '
130- 'ensure it is available in the environment' );
129+ throw Exception (
130+ 'Unable to determine the home directory, '
131+ 'ensure it is available in the environment' ,
132+ );
131133 }
132134 if (! checkDirectoryForWritePermissions (homeDirectory)) {
133135 throw Exception ('Permissions error on the home directory!' );
@@ -313,7 +315,8 @@ abstract class Analytics {
313315 dartVersion: dartVersion,
314316 platform: platform,
315317 fs: fs,
316- surveyHandler: surveyHandler ??
318+ surveyHandler:
319+ surveyHandler ??
317320 FakeSurveyHandler .fromList (
318321 dismissedSurveyFile: homeDirectory
319322 .childDirectory (kDartToolDirectoryName)
@@ -386,40 +389,42 @@ class AnalyticsImpl implements Analytics {
386389 required SurveyHandler surveyHandler,
387390 required bool enableAsserts,
388391 required bool firstRun,
389- }) : _gaClient = gaClient,
390- _surveyHandler = surveyHandler,
391- _enableAsserts = enableAsserts,
392- _clientIdFile = homeDirectory
393- .childDirectory (kDartToolDirectoryName)
394- .childFile (kClientIdFileName),
395- _userProperty = UserProperty (
396- sessionFile: homeDirectory
397- .childDirectory (kDartToolDirectoryName)
398- .childFile (kSessionFileName),
399- flutterChannel: flutterChannel,
400- host: platform.label,
401- flutterVersion: flutterVersion,
402- dartVersion: dartVersion,
403- tool: tool.label,
404- // We truncate this to a maximum of 36 characters since this can
405- // a very long string for some operating systems
406- hostOsVersion:
407- truncateStringToLength (io.Platform .operatingSystemVersion, 36 ),
408- locale: io.Platform .localeName,
409- clientIde: clientIde,
410- ),
411- _enabledFeatures = enabledFeatures,
412- _configHandler = ConfigHandler (
413- homeDirectory: homeDirectory,
414- configFile: homeDirectory
415- .childDirectory (kDartToolDirectoryName)
416- .childFile (kConfigFileName),
417- ),
418- _logHandler = LogHandler (
419- logFile: homeDirectory
420- .childDirectory (kDartToolDirectoryName)
421- .childFile (kLogFileName),
422- ) {
392+ }) : _gaClient = gaClient,
393+ _surveyHandler = surveyHandler,
394+ _enableAsserts = enableAsserts,
395+ _clientIdFile = homeDirectory
396+ .childDirectory (kDartToolDirectoryName)
397+ .childFile (kClientIdFileName),
398+ _userProperty = UserProperty (
399+ sessionFile: homeDirectory
400+ .childDirectory (kDartToolDirectoryName)
401+ .childFile (kSessionFileName),
402+ flutterChannel: flutterChannel,
403+ host: platform.label,
404+ flutterVersion: flutterVersion,
405+ dartVersion: dartVersion,
406+ tool: tool.label,
407+ // We truncate this to a maximum of 36 characters since this can
408+ // a very long string for some operating systems
409+ hostOsVersion: truncateStringToLength (
410+ io.Platform .operatingSystemVersion,
411+ 36 ,
412+ ),
413+ locale: io.Platform .localeName,
414+ clientIde: clientIde,
415+ ),
416+ _enabledFeatures = enabledFeatures,
417+ _configHandler = ConfigHandler (
418+ homeDirectory: homeDirectory,
419+ configFile: homeDirectory
420+ .childDirectory (kDartToolDirectoryName)
421+ .childFile (kConfigFileName),
422+ ),
423+ _logHandler = LogHandler (
424+ logFile: homeDirectory
425+ .childDirectory (kDartToolDirectoryName)
426+ .childFile (kLogFileName),
427+ ) {
423428 // This initializer class will let the instance know
424429 // if it was the first run; if it is, nothing will be sent
425430 // on the first run
@@ -464,8 +469,8 @@ class AnalyticsImpl implements Analytics {
464469 // The command to swap in the consent message
465470 final commandString =
466471 tool == DashTool .flutterTool || tool == DashTool .devtools
467- ? 'flutter'
468- : 'dart' ;
472+ ? 'flutter'
473+ : 'dart' ;
469474
470475 return kToolsMessage
471476 .replaceAll ('{{ toolDescription }}' , tool.description)
@@ -529,10 +534,9 @@ class AnalyticsImpl implements Analytics {
529534 // Collect any errors encountered and send
530535 _sendPendingErrorEvents ();
531536
532- await Future .wait (_futures).timeout (
533- Duration (milliseconds: delayDuration),
534- onTimeout: () => [],
535- );
537+ await Future .wait (
538+ _futures,
539+ ).timeout (Duration (milliseconds: delayDuration), onTimeout: () => []);
536540 _gaClient.close ();
537541 }
538542
@@ -571,8 +575,9 @@ class AnalyticsImpl implements Analytics {
571575 for (final condition in survey.conditionList) {
572576 // Retrieve the value from the [LogFileStats] with
573577 // the label provided in the condtion
574- final logFileStatsValue =
575- logFileStats.getValueByString (condition.field);
578+ final logFileStatsValue = logFileStats.getValueByString (
579+ condition.field,
580+ );
576581
577582 if (logFileStatsValue == null ) continue ;
578583
@@ -631,8 +636,9 @@ class AnalyticsImpl implements Analytics {
631636 _configHandler.setTelemetry (reportingBool);
632637
633638 // Creation of the [Event] for opting out
634- final collectionEvent =
635- Event .analyticsCollectionEnabled (status: reportingBool);
639+ final collectionEvent = Event .analyticsCollectionEnabled (
640+ status: reportingBool,
641+ );
636642
637643 // The body of the request that will be sent to GA4
638644 final Map <String , Object ?> body;
@@ -681,7 +687,9 @@ class AnalyticsImpl implements Analytics {
681687
682688 // Pass to the google analytics client to send with a
683689 // timeout incase http clients hang
684- return _gaClient.sendData (body).timeout (
690+ return _gaClient
691+ .sendData (body)
692+ .timeout (
685693 const Duration (milliseconds: kDelayDuration),
686694 onTimeout: () => Response ('' , 200 ),
687695 );
@@ -698,10 +706,12 @@ class AnalyticsImpl implements Analytics {
698706 // Any action, except for 'snooze' will permanently dismiss a given survey
699707 final permanentlyDismissed = surveyButton.action == 'snooze' ? false : true ;
700708 _surveyHandler.dismiss (survey, permanentlyDismissed);
701- send (Event .surveyAction (
702- surveyId: survey.uniqueId,
703- status: surveyButton.action,
704- ));
709+ send (
710+ Event .surveyAction (
711+ surveyId: survey.uniqueId,
712+ status: surveyButton.action,
713+ ),
714+ );
705715 }
706716
707717 @override
@@ -721,9 +731,11 @@ class AnalyticsImpl implements Analytics {
721731 // Collect any errors encountered and send
722732 final errorEvents = {..._userProperty.errorSet, ..._logHandler.errorSet};
723733 errorEvents
724- .where ((event) =>
725- event.eventName == DashEvent .analyticsException &&
726- ! _sentErrorEvents.contains (event))
734+ .where (
735+ (event) =>
736+ event.eventName == DashEvent .analyticsException &&
737+ ! _sentErrorEvents.contains (event),
738+ )
727739 .forEach (send);
728740
729741 // Ensure the same event doesn't get sent again
0 commit comments