Unverified Commit a8c4da22 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

add a kIsWeb constant to foundation (#36135)

parent 180aa0c0
......@@ -38,3 +38,12 @@ const bool kDebugMode = !kReleaseMode && !kProfileMode;
/// 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);
// 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);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment