Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a8c4da22
Unverified
Commit
a8c4da22
authored
Jul 16, 2019
by
Jonah Williams
Committed by
GitHub
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a kIsWeb constant to foundation (#36135)
parent
180aa0c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
constants.dart
packages/flutter/lib/src/foundation/constants.dart
+9
-0
constants_test.dart
packages/flutter/test/foundation/constants_test.dart
+13
-0
No files found.
packages/flutter/lib/src/foundation/constants.dart
View file @
a8c4da22
...
...
@@ -38,3 +38,12 @@ const bool kDebugMode = !kReleaseMode && !kProfileMode;
/// precision loss in calculations. Differences below this threshold are safe to
/// disregard.
const
double
precisionErrorTolerance
=
1
e
-
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
);
packages/flutter/test/foundation/constants_test.dart
0 → 100644
View file @
a8c4da22
// 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
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment