getPackageFromUri method Null safety
- Uri? uri
Implementation
Future<Package?> getPackageFromUri(Uri? uri) async {
if (uri == null) {
return null;
}
if (uri.scheme == "package") {
final segments = uri.pathSegments;
return (await packageConfig)[segments.first]!;
} else if (!uri.isAbsolute) {
throw ArgumentError("'uri' must be absolute or a package URI");
}
return null;
}