[flutter_tools] report basic analytics for null-safety (#71487)
This commit is contained in:
@@ -487,6 +487,9 @@ abstract class FlutterCommand extends Command<void> {
|
||||
/// Whether it is safe for this command to use a cached pub invocation.
|
||||
bool get cachePubGet => true;
|
||||
|
||||
/// Whether this command should report null safety analytics.
|
||||
bool get reportNullSafety => false;
|
||||
|
||||
Duration get deviceDiscoveryTimeout {
|
||||
if (_deviceDiscoveryTimeout == null
|
||||
&& argResults.options.contains(FlutterOptions.kDeviceTimeout)
|
||||
@@ -1112,6 +1115,9 @@ abstract class FlutterCommand extends Command<void> {
|
||||
checkUpToDate: cachePubGet,
|
||||
);
|
||||
await project.regeneratePlatformSpecificTooling();
|
||||
if (reportNullSafety) {
|
||||
await _sendNullSafetyAnalyticsEvents(project);
|
||||
}
|
||||
}
|
||||
|
||||
setupApplicationPackages();
|
||||
@@ -1128,6 +1134,16 @@ abstract class FlutterCommand extends Command<void> {
|
||||
return await runCommand();
|
||||
}
|
||||
|
||||
Future<void> _sendNullSafetyAnalyticsEvents(FlutterProject project) async {
|
||||
final BuildInfo buildInfo = await getBuildInfo();
|
||||
NullSafetyAnalysisEvent(
|
||||
buildInfo.packageConfig,
|
||||
buildInfo.nullSafetyMode,
|
||||
project.manifest.appName,
|
||||
globals.flutterUsage,
|
||||
).send();
|
||||
}
|
||||
|
||||
/// The set of development artifacts required for this command.
|
||||
///
|
||||
/// Defaults to an empty set. Including [DevelopmentArtifact.universal] is
|
||||
|
||||
Reference in New Issue
Block a user