Created
January 14, 2017 18:29
-
-
Save BlackHC/a26b0a3742d1814d7f7c58adc53b8179 to your computer and use it in GitHub Desktop.
Merging package configs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:package_resolver/package_resolver.dart'; | |
| Future<PackageResolver> mergePackageConfigs(String otherPackageRoot) async { | |
| final currentConfig = await PackageResolver.current.packageConfigMap; | |
| final otherConfig = | |
| (await SyncPackageResolver.loadConfig(otherPackageRoot + '/.packages')) | |
| .packageConfigMap; | |
| // We do something horrible here: We simply merge the current config with | |
| // the other. Hoping it will still work.. | |
| final config = <String, Uri>{}; | |
| config.addAll(currentConfig); | |
| config.addAll(otherConfig); | |
| return new PackageResolver.config(config); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment