Unverified Commit 11f8ee5b authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Add docs for kIsWeb on defaultTargetPlatform (#125313)

## Description

Adding some see also links to connect `defaultTargetPlatform` and `kIsWeb` docs.
parent c9004ff8
...@@ -68,4 +68,13 @@ const bool kDebugMode = !kReleaseMode && !kProfileMode; ...@@ -68,4 +68,13 @@ const bool kDebugMode = !kReleaseMode && !kProfileMode;
const double precisionErrorTolerance = 1e-10; const double precisionErrorTolerance = 1e-10;
/// A constant that is true if the application was compiled to run on the web. /// A constant that is true if the application was compiled to run on the web.
///
/// See also:
///
/// * [defaultTargetPlatform], which is used by themes to find out which
/// platform the application is running on (or, in the case of a web app,
/// which platform the application's browser is running in). Can be overridden
/// in tests with [debugDefaultTargetPlatformOverride].
/// * [dart:io.Platform], a way to find out the browser's platform that is not
/// overridable in tests.
const bool kIsWeb = bool.fromEnvironment('dart.library.js_util'); const bool kIsWeb = bool.fromEnvironment('dart.library.js_util');
...@@ -26,6 +26,12 @@ import '_platform_io.dart' ...@@ -26,6 +26,12 @@ import '_platform_io.dart'
/// ///
/// Tests can also create specific platform tests by and adding a `variant:` /// Tests can also create specific platform tests by and adding a `variant:`
/// argument to the test and using a [TargetPlatformVariant]. /// argument to the test and using a [TargetPlatformVariant].
///
/// See also:
///
/// * [kIsWeb], a boolean which is true if the application is running on the
/// web, where [defaultTargetPlatform] returns which platform the browser is
/// running on.
// //
// When adding support for a new platform (e.g. Windows Phone, Raspberry Pi), // When adding support for a new platform (e.g. Windows Phone, Raspberry Pi),
// first create a new value on the [TargetPlatform] enum, then add a rule for // first create a new value on the [TargetPlatform] enum, then add a rule for
......
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