Skip to content

Commit

Permalink
Remove the if statement in getArchForTargetPlatform
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim committed Jun 13, 2024
1 parent 58610d3 commit 03ba07f
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lib/tizen_build_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,20 @@ class TizenBuildInfo {

/// See: [getNameForTargetPlatform] in `build_info.dart`
String getArchForTargetPlatform(TargetPlatform platform) {
if (platform == TargetPlatform.android_arm64) {
return 'arm64';
} else if (platform == TargetPlatform.android_x86) {
return 'x86';
} else {
return 'arm';
}
return switch (platform) {
TargetPlatform.android_arm => 'arm',
TargetPlatform.android_arm64 => 'arm64',
TargetPlatform.android_x86 => 'x86',
_ => throw ArgumentError('Unexpected platform $platform'),
};
}

/// See: [getTargetPlatformForName] in `build_info.dart`
TargetPlatform getTargetPlatformForArch(String arch) {
switch (arch) {
case 'arm64':
return TargetPlatform.android_arm64;
case 'x86':
return TargetPlatform.android_x86;
default:
return TargetPlatform.android_arm;
}
return switch (arch) {
'arm' => TargetPlatform.android_arm,
'arm64' => TargetPlatform.android_arm64,
'x86' => TargetPlatform.android_x86,
_ => throw ArgumentError('Unexpected arch name $arch'),
};
}

0 comments on commit 03ba07f

Please sign in to comment.