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
23301557
Unverified
Commit
23301557
authored
Mar 09, 2021
by
Jonah Williams
Committed by
GitHub
Mar 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] simplify platform null safety (#77727)
parent
fb2cffb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
platform.dart
packages/flutter_tools/lib/src/base/platform.dart
+21
-22
user_messages_test.dart
...ter_tools/test/general.shard/base/user_messages_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/base/platform.dart
View file @
23301557
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:io'
as
io
show
Platform
,
stdin
,
stdout
;
/// Provides API parity with the `Platform` class in `dart:io`, but using
...
...
@@ -103,7 +101,7 @@ abstract class Platform {
/// specifies how Dart packages are looked up.
///
/// If there is no `--packages` flag, `null` is returned.
String
get
packageConfig
;
String
?
get
packageConfig
;
/// The version of the current Dart runtime.
///
...
...
@@ -158,7 +156,7 @@ class LocalPlatform extends Platform {
List
<
String
>
get
executableArguments
=>
io
.
Platform
.
executableArguments
;
@override
String
get
packageConfig
=>
io
.
Platform
.
packageConfig
;
String
?
get
packageConfig
=>
io
.
Platform
.
packageConfig
;
@override
String
get
version
=>
io
.
Platform
.
version
;
...
...
@@ -173,29 +171,30 @@ class LocalPlatform extends Platform {
String
get
localeName
=>
io
.
Platform
.
localeName
;
}
final
Uri
_empty
=
Uri
.
parse
(
''
);
/// Provides a mutable implementation of the [Platform] interface.
class
FakePlatform
extends
Platform
{
/// Creates a new [FakePlatform] with the specified properties.
///
/// Unspecified properties will *not* be assigned default values (they will
/// remain `null`).
/// Unspecified properties will default to a 'linux' OS.
FakePlatform
({
this
.
numberOfProcessors
,
this
.
pathSeparator
,
this
.
operatingSystem
,
this
.
operatingSystemVersion
,
this
.
localHostname
,
this
.
environment
,
this
.
executable
,
this
.
resolvedExecutable
,
this
.
script
,
this
.
executableArguments
,
this
.
numberOfProcessors
=
1
,
this
.
pathSeparator
=
'/'
,
this
.
operatingSystem
=
'linux'
,
this
.
operatingSystemVersion
=
''
,
this
.
localHostname
=
''
,
this
.
environment
=
const
<
String
,
String
>{}
,
this
.
executable
=
''
,
this
.
resolvedExecutable
=
''
,
Uri
?
script
,
this
.
executableArguments
=
const
<
String
>[]
,
this
.
packageConfig
,
this
.
version
,
this
.
stdinSupportsAnsi
,
this
.
stdoutSupportsAnsi
,
this
.
localeName
,
});
this
.
version
=
''
,
this
.
stdinSupportsAnsi
=
false
,
this
.
stdoutSupportsAnsi
=
false
,
this
.
localeName
=
''
,
})
:
script
=
script
??
_empty
;
/// Creates a new [FakePlatform] with properties whose initial values mirror
/// the specified [platform].
...
...
@@ -248,7 +247,7 @@ class FakePlatform extends Platform {
List
<
String
>
executableArguments
;
@override
String
packageConfig
;
String
?
packageConfig
;
@override
String
version
;
...
...
packages/flutter_tools/test/general.shard/base/user_messages_test.dart
View file @
23301557
...
...
@@ -20,7 +20,7 @@ void main() {
expect
(
message
(
macPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/macos#android-setup'
));
expect
(
message
(
linuxPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/linux#android-setup'
));
expect
(
message
(
windowsPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/windows#android-setup'
));
expect
(
message
(
FakePlatform
()),
contains
(
'https://flutter.dev/docs/get-started/install '
));
expect
(
message
(
FakePlatform
(
operatingSystem:
''
)),
contains
(
'https://flutter.dev/docs/get-started/install '
));
}
testWithoutContext
(
'Android installation instructions'
,
()
{
...
...
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