forked from firka/flutter
Reland "if chains → switch expressions" (#148634)
I did a goof a while back:

Now that [the bug is fixed](e9d403541f), I think we're good to re-implement the if-chains cleanup!
Related:
- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
This commit is contained in:
@@ -115,18 +115,15 @@ class MultiRootFileSystem extends ForwardingFileSystem {
|
||||
/// If the path is a multiroot uri, resolve to the actual path of the
|
||||
/// underlying file system. Otherwise, return as is.
|
||||
dynamic _resolve(dynamic path) {
|
||||
Uri uri;
|
||||
if (path == null) {
|
||||
return null;
|
||||
} else if (path is String) {
|
||||
uri = Uri.parse(path);
|
||||
} else if (path is Uri) {
|
||||
uri = path;
|
||||
} else if (path is FileSystemEntity) {
|
||||
uri = path.uri;
|
||||
} else {
|
||||
throw ArgumentError('Invalid type for "path": ${(path as Object?)?.runtimeType}');
|
||||
}
|
||||
final Uri uri = switch (path) {
|
||||
String() => Uri.parse(path),
|
||||
Uri() => path,
|
||||
FileSystemEntity() => path.uri,
|
||||
_ => throw ArgumentError('Invalid type for "path": ${(path as Object?)?.runtimeType}'),
|
||||
};
|
||||
|
||||
if (!uri.hasScheme || uri.scheme != _scheme) {
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user