add a kIsWeb constant to foundation (#36135)


diff --git a/packages/flutter/lib/src/foundation/constants.dart b/packages/flutter/lib/src/foundation/constants.dart
index 804ece0..a78f9c2 100644
--- a/packages/flutter/lib/src/foundation/constants.dart
+++ b/packages/flutter/lib/src/foundation/constants.dart
@@ -38,3 +38,12 @@
 /// precision loss in calculations. Differences below this threshold are safe to
 /// disregard.
 const double precisionErrorTolerance = 1e-10;
+
+/// A constant that is true if the application was compiled to run on the web.
+///
+/// This implementation takes advantage of the fact that JavaScript does not
+/// support integers. In this environment, Dart's doubles and ints are
+/// backed by the same kind of object. Thus a double `0.0` is identical
+/// to an integer `0`. This is not true for Dart code running in AOT or on the
+/// VM.
+const bool kIsWeb = identical(0, 0.0);
diff --git a/packages/flutter/test/foundation/constants_test.dart b/packages/flutter/test/foundation/constants_test.dart
new file mode 100644
index 0000000..e5dd97c
--- /dev/null
+++ b/packages/flutter/test/foundation/constants_test.dart
@@ -0,0 +1,13 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+@TestOn('!chrome') // This test is not intended to run on the web.
+import 'package:flutter/foundation.dart';
+import '../flutter_test_alternative.dart';
+
+void main() {
+  test('isWeb is false for flutter tester', () {
+    expect(kIsWeb, false);
+  });
+}