lint unnecessary_const on samples (#21155)

diff --git a/dev/bots/analyze-sample-code.dart b/dev/bots/analyze-sample-code.dart
index 4507ebb..a3087b7 100644
--- a/dev/bots/analyze-sample-code.dart
+++ b/dev/bots/analyze-sample-code.dart
@@ -107,6 +107,7 @@
   try {
     final File mainDart = new File(path.join(tempDir.path, 'main.dart'));
     final File pubSpec = new File(path.join(tempDir.path, 'pubspec.yaml'));
+    final File analysisOptions = new File(path.join(tempDir.path, 'analysis_options.yaml'));
     Directory flutterPackage;
     if (arguments.length == 1) {
       // Used for testing.
@@ -213,6 +214,11 @@
   flutter_test:
     sdk: flutter
 ''');
+    analysisOptions.writeAsStringSync('''
+linter:
+  rules:
+    - unnecessary_const
+''');
     print('Found $sampleCodeSections sample code sections.');
     final Process process = await Process.start(
       _flutter,