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
0f9d66aa
Unverified
Commit
0f9d66aa
authored
May 03, 2023
by
Kevin Moore
Committed by
GitHub
May 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool: use switch expressions (#125930)
parent
c12488a7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
102 deletions
+61
-102
os.dart
packages/flutter_tools/lib/src/base/os.dart
+7
-12
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+29
-48
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+7
-12
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+4
-6
macos_device_test.dart
...ter_tools/test/general.shard/macos/macos_device_test.dart
+6
-10
fake_http_client.dart
packages/flutter_tools/test/src/fake_http_client.dart
+8
-14
No files found.
packages/flutter_tools/lib/src/base/os.dart
View file @
0f9d66aa
...
...
@@ -611,16 +611,11 @@ enum HostPlatform {
}
String
getNameForHostPlatform
(
HostPlatform
platform
)
{
switch
(
platform
)
{
case
HostPlatform
.
darwin_x64
:
return
'darwin-x64'
;
case
HostPlatform
.
darwin_arm64
:
return
'darwin-arm64'
;
case
HostPlatform
.
linux_x64
:
return
'linux-x64'
;
case
HostPlatform
.
linux_arm64
:
return
'linux-arm64'
;
case
HostPlatform
.
windows_x64
:
return
'windows-x64'
;
}
return
switch
(
platform
)
{
HostPlatform
.
darwin_x64
=>
'darwin-x64'
,
HostPlatform
.
darwin_arm64
=>
'darwin-arm64'
,
HostPlatform
.
linux_x64
=>
'linux-x64'
,
HostPlatform
.
linux_arm64
=>
'linux-arm64'
,
HostPlatform
.
windows_x64
=>
'windows-x64'
};
}
packages/flutter_tools/lib/src/build_info.dart
View file @
0f9d66aa
...
...
@@ -614,14 +614,11 @@ List<DarwinArch> defaultMacOSArchsForEnvironment(Artifacts artifacts) {
// instructions are then built into architecture-specific binaries, which are
// merged into a universal binary using the `lipo` tool.
String
getDartNameForDarwinArch
(
DarwinArch
arch
)
{
switch
(
arch
)
{
case
DarwinArch
.
armv7
:
return
'armv7'
;
case
DarwinArch
.
arm64
:
return
'arm64'
;
case
DarwinArch
.
x86_64
:
return
'x64'
;
}
return
switch
(
arch
)
{
DarwinArch
.
armv7
=>
'armv7'
,
DarwinArch
.
arm64
=>
'arm64'
,
DarwinArch
.
x86_64
=>
'x64'
};
}
// Returns Apple's name for the specified target architecture.
...
...
@@ -633,14 +630,11 @@ String getDartNameForDarwinArch(DarwinArch arch) {
// For consistency with developer expectations, Flutter outputs also use these
// architecture names in its build products for Darwin target platforms.
String
getNameForDarwinArch
(
DarwinArch
arch
)
{
switch
(
arch
)
{
case
DarwinArch
.
armv7
:
return
'armv7'
;
case
DarwinArch
.
arm64
:
return
'arm64'
;
case
DarwinArch
.
x86_64
:
return
'x86_64'
;
}
return
switch
(
arch
)
{
DarwinArch
.
armv7
=>
'armv7'
,
DarwinArch
.
arm64
=>
'arm64'
,
DarwinArch
.
x86_64
=>
'x86_64'
};
}
DarwinArch
getIOSArchForName
(
String
arch
)
{
...
...
@@ -758,29 +752,21 @@ AndroidArch getAndroidArchForName(String platform) {
}
String
getNameForAndroidArch
(
AndroidArch
arch
)
{
switch
(
arch
)
{
case
AndroidArch
.
armeabi_v7a
:
return
'armeabi-v7a'
;
case
AndroidArch
.
arm64_v8a
:
return
'arm64-v8a'
;
case
AndroidArch
.
x86_64
:
return
'x86_64'
;
case
AndroidArch
.
x86
:
return
'x86'
;
}
return
switch
(
arch
)
{
AndroidArch
.
armeabi_v7a
=>
'armeabi-v7a'
,
AndroidArch
.
arm64_v8a
=>
'arm64-v8a'
,
AndroidArch
.
x86_64
=>
'x86_64'
,
AndroidArch
.
x86
=>
'x86'
};
}
String
getPlatformNameForAndroidArch
(
AndroidArch
arch
)
{
switch
(
arch
)
{
case
AndroidArch
.
armeabi_v7a
:
return
'android-arm'
;
case
AndroidArch
.
arm64_v8a
:
return
'android-arm64'
;
case
AndroidArch
.
x86_64
:
return
'android-x64'
;
case
AndroidArch
.
x86
:
return
'android-x86'
;
}
return
switch
(
arch
)
{
AndroidArch
.
armeabi_v7a
=>
'android-arm'
,
AndroidArch
.
arm64_v8a
=>
'android-arm64'
,
AndroidArch
.
x86_64
=>
'android-x64'
,
AndroidArch
.
x86
=>
'android-x86'
};
}
String
fuchsiaArchForTargetPlatform
(
TargetPlatform
targetPlatform
)
{
...
...
@@ -1059,18 +1045,13 @@ String getNameForTargetPlatformArch(TargetPlatform platform) {
}
String
getNameForHostPlatformArch
(
HostPlatform
platform
)
{
switch
(
platform
)
{
case
HostPlatform
.
darwin_x64
:
return
'x64'
;
case
HostPlatform
.
darwin_arm64
:
return
'arm64'
;
case
HostPlatform
.
linux_x64
:
return
'x64'
;
case
HostPlatform
.
linux_arm64
:
return
'arm64'
;
case
HostPlatform
.
windows_x64
:
return
'x64'
;
}
return
switch
(
platform
)
{
HostPlatform
.
darwin_x64
=>
'x64'
,
HostPlatform
.
darwin_arm64
=>
'arm64'
,
HostPlatform
.
linux_x64
=>
'x64'
,
HostPlatform
.
linux_arm64
=>
'arm64'
,
HostPlatform
.
windows_x64
=>
'x64'
};
}
String
?
_uncapitalize
(
String
?
s
)
{
...
...
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
0f9d66aa
...
...
@@ -1160,18 +1160,13 @@ class InvalidatedReason {
@override
String
toString
()
{
switch
(
kind
)
{
case
InvalidatedReasonKind
.
inputMissing
:
return
'The following inputs were missing:
${data.join(',')}
'
;
case
InvalidatedReasonKind
.
inputChanged
:
return
'The following inputs have updated contents:
${data.join(',')}
'
;
case
InvalidatedReasonKind
.
outputChanged
:
return
'The following outputs have updated contents:
${data.join(',')}
'
;
case
InvalidatedReasonKind
.
outputMissing
:
return
'The following outputs were missing:
${data.join(',')}
'
;
case
InvalidatedReasonKind
.
outputSetChanged
:
return
'The following outputs were removed from the output set:
${data.join(',')}
'
;
}
return
switch
(
kind
)
{
InvalidatedReasonKind
.
inputMissing
=>
'The following inputs were missing:
${data.join(',')}
'
,
InvalidatedReasonKind
.
inputChanged
=>
'The following inputs have updated contents:
${data.join(',')}
'
,
InvalidatedReasonKind
.
outputChanged
=>
'The following outputs have updated contents:
${data.join(',')}
'
,
InvalidatedReasonKind
.
outputMissing
=>
'The following outputs were missing:
${data.join(',')}
'
,
InvalidatedReasonKind
.
outputSetChanged
=>
'The following outputs were removed from the output set:
${data.join(',')}
'
};
}
}
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
0f9d66aa
...
...
@@ -578,12 +578,10 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result, Usage flutterUsa
enum
XcodeBuildAction
{
build
,
archive
}
String
xcodeBuildActionToString
(
XcodeBuildAction
action
)
{
switch
(
action
)
{
case
XcodeBuildAction
.
build
:
return
'build'
;
case
XcodeBuildAction
.
archive
:
return
'archive'
;
}
return
switch
(
action
)
{
XcodeBuildAction
.
build
=>
'build'
,
XcodeBuildAction
.
archive
=>
'archive'
};
}
class
XcodeBuildResult
{
...
...
packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
View file @
0f9d66aa
...
...
@@ -252,15 +252,11 @@ FlutterProject setUpFlutterProject(Directory directory) {
class
FakeMacOSApp
extends
Fake
implements
MacOSApp
{
@override
String
executable
(
BuildInfo
buildInfo
)
{
switch
(
buildInfo
)
{
case
BuildInfo
.
debug
:
return
'debug/executable'
;
case
BuildInfo
.
profile
:
return
'profile/executable'
;
case
BuildInfo
.
release
:
return
'release/executable'
;
default
:
throw
StateError
(
''
);
}
return
switch
(
buildInfo
)
{
BuildInfo
.
debug
=>
'debug/executable'
,
BuildInfo
.
profile
=>
'profile/executable'
,
BuildInfo
.
release
=>
'release/executable'
,
_
=>
throw
StateError
(
''
)
};
}
}
packages/flutter_tools/test/src/fake_http_client.dart
View file @
0f9d66aa
...
...
@@ -40,20 +40,14 @@ HttpMethod _fromMethodString(String value) {
}
String
_toMethodString
(
HttpMethod
method
)
{
switch
(
method
)
{
case
HttpMethod
.
get
:
return
'GET'
;
case
HttpMethod
.
put
:
return
'PUT'
;
case
HttpMethod
.
delete
:
return
'DELETE'
;
case
HttpMethod
.
post
:
return
'POST'
;
case
HttpMethod
.
patch
:
return
'PATCH'
;
case
HttpMethod
.
head
:
return
'HEAD'
;
}
return
switch
(
method
)
{
HttpMethod
.
get
=>
'GET'
,
HttpMethod
.
put
=>
'PUT'
,
HttpMethod
.
delete
=>
'DELETE'
,
HttpMethod
.
post
=>
'POST'
,
HttpMethod
.
patch
=>
'PATCH'
,
HttpMethod
.
head
=>
'HEAD'
};
}
/// Create a fake request that configures the [FakeHttpClient] to respond
...
...
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