Add docs for kIsWeb on defaultTargetPlatform (#125313)

## Description

Adding some see also links to connect `defaultTargetPlatform` and `kIsWeb` docs.
This commit is contained in:
Greg Spencer 2023-04-21 12:11:29 -07:00 committed by GitHub
parent c9004ff822
commit 11f8ee5bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -68,4 +68,13 @@ const bool kDebugMode = !kReleaseMode && !kProfileMode;
const double precisionErrorTolerance = 1e-10;
/// 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');

View File

@ -26,6 +26,12 @@ import '_platform_io.dart'
///
/// Tests can also create specific platform tests by and adding a `variant:`
/// 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),
// first create a new value on the [TargetPlatform] enum, then add a rule for