@@ -55,17 +55,6 @@ class PreparePackageException implements Exception {
55
55
enum Branch {
56
56
beta,
57
57
stable;
58
-
59
- static Branch fromName (String name) {
60
- switch (name) {
61
- case 'beta' :
62
- return Branch .beta;
63
- case 'stable' :
64
- return Branch .stable;
65
- default :
66
- throw ArgumentError ('Invalid branch name.' );
67
- }
68
- }
69
58
}
70
59
71
60
/// A helper class for classes that want to run a process, optionally have the
@@ -860,10 +849,10 @@ Future<void> main(List<String> rawArguments) async {
860
849
exit (exitCode);
861
850
}
862
851
863
- final String revision = parsedArguments['revision' ] as String ;
864
852
if (! parsedArguments.wasParsed ('revision' )) {
865
853
errorExit ('Invalid argument: --revision must be specified.' );
866
854
}
855
+ final String revision = parsedArguments['revision' ] as String ;
867
856
if (revision.length != 40 ) {
868
857
errorExit ('Invalid argument: --revision must be the entire hash, not just a prefix.' );
869
858
}
@@ -872,7 +861,7 @@ Future<void> main(List<String> rawArguments) async {
872
861
errorExit ('Invalid argument: --branch must be specified.' );
873
862
}
874
863
875
- final String tempDirArg = parsedArguments['temp_dir' ] as String ;
864
+ final String ? tempDirArg = parsedArguments['temp_dir' ] as String ? ;
876
865
Directory tempDir;
877
866
bool removeTempDir = false ;
878
867
if (tempDirArg == null || tempDirArg.isEmpty) {
@@ -897,7 +886,7 @@ Future<void> main(List<String> rawArguments) async {
897
886
898
887
final bool publish = parsedArguments['publish' ] as bool ;
899
888
final bool dryRun = parsedArguments['dry_run' ] as bool ;
900
- final Branch branch = Branch .fromName (parsedArguments['branch' ] as String );
889
+ final Branch branch = Branch .values. byName (parsedArguments['branch' ] as String );
901
890
final ArchiveCreator creator = ArchiveCreator (
902
891
tempDir,
903
892
outputDir,
0 commit comments