Refactor BuildMode into class, add jit_release configuration (#42476)

diff --git a/packages/flutter_tools/test/general.shard/build_info_test.dart b/packages/flutter_tools/test/general.shard/build_info_test.dart
index d404696..9b5c640 100644
--- a/packages/flutter_tools/test/general.shard/build_info_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_info_test.dart
@@ -53,5 +53,29 @@
       buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, 'abc+-');
       expect(buildName, 'abc+-');
     });
+
+    test('build mode configuration is correct', () {
+      expect(BuildMode.debug.isRelease, false);
+      expect(BuildMode.debug.isPrecompiled, false);
+      expect(BuildMode.debug.isJit, true);
+
+      expect(BuildMode.profile.isRelease, false);
+      expect(BuildMode.profile.isPrecompiled, true);
+      expect(BuildMode.profile.isJit, false);
+
+      expect(BuildMode.release.isRelease, true);
+      expect(BuildMode.release.isPrecompiled, true);
+      expect(BuildMode.release.isJit, false);
+
+      expect(BuildMode.jitRelease.isRelease, true);
+      expect(BuildMode.jitRelease.isPrecompiled, false);
+      expect(BuildMode.jitRelease.isJit, true);
+
+      expect(BuildMode.fromName('debug'), BuildMode.debug);
+      expect(BuildMode.fromName('profile'), BuildMode.profile);
+      expect(BuildMode.fromName('jit_release'), BuildMode.jitRelease);
+      expect(BuildMode.fromName('release'), BuildMode.release);
+      expect(() => BuildMode.fromName('foo'), throwsA(isInstanceOf<ArgumentError>()));
+    });
   });
 }