Skip to content

Commit 11f8ee5

Browse files
authored
Add docs for kIsWeb on defaultTargetPlatform (#125313)
## Description Adding some see also links to connect `defaultTargetPlatform` and `kIsWeb` docs.
1 parent c9004ff commit 11f8ee5

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/flutter/lib/src/foundation/constants.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,13 @@ const bool kDebugMode = !kReleaseMode && !kProfileMode;
6868
const double precisionErrorTolerance = 1e-10;
6969

7070
/// A constant that is true if the application was compiled to run on the web.
71+
///
72+
/// See also:
73+
///
74+
/// * [defaultTargetPlatform], which is used by themes to find out which
75+
/// platform the application is running on (or, in the case of a web app,
76+
/// which platform the application's browser is running in). Can be overridden
77+
/// in tests with [debugDefaultTargetPlatformOverride].
78+
/// * [dart:io.Platform], a way to find out the browser's platform that is not
79+
/// overridable in tests.
7180
const bool kIsWeb = bool.fromEnvironment('dart.library.js_util');

packages/flutter/lib/src/foundation/platform.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ import '_platform_io.dart'
2626
///
2727
/// Tests can also create specific platform tests by and adding a `variant:`
2828
/// argument to the test and using a [TargetPlatformVariant].
29+
///
30+
/// See also:
31+
///
32+
/// * [kIsWeb], a boolean which is true if the application is running on the
33+
/// web, where [defaultTargetPlatform] returns which platform the browser is
34+
/// running on.
2935
//
3036
// When adding support for a new platform (e.g. Windows Phone, Raspberry Pi),
3137
// first create a new value on the [TargetPlatform] enum, then add a rule for

0 commit comments

Comments
 (0)