Make create command use pub in offline mode. (#13462)

In order to allow offline usage of the create command we need to be able to tell pub not to try and contact the server to see if new versions are available. Since all the versions that create could want are pinned, it shouldn't need to check for new versions.
This commit is contained in:
Greg Spencer
2017-12-08 15:32:10 -08:00
committed by GitHub
parent d25e0eb0d3
commit aedee0df3d
2 changed files with 57 additions and 3 deletions

View File

@@ -162,7 +162,11 @@ class CreateCommand extends FlutterCommand {
generatedCount += _renderTemplate('package', dirPath, templateContext);
if (argResults['pub'])
await pubGet(context: PubContext.createPackage, directory: dirPath);
await pubGet(
context: PubContext.createPackage,
directory: dirPath,
offline: true,
);
final String relativePath = fs.path.relative(dirPath);
printStatus('Wrote $generatedCount files.');
@@ -180,7 +184,11 @@ class CreateCommand extends FlutterCommand {
generatedCount += _renderTemplate('plugin', dirPath, templateContext);
if (argResults['pub'])
await pubGet(context: PubContext.createPlugin, directory: dirPath);
await pubGet(
context: PubContext.createPlugin,
directory: dirPath,
offline: true,
);
if (android_sdk.androidSdk != null)
gradle.updateLocalProperties(projectPath: dirPath);
@@ -218,7 +226,7 @@ class CreateCommand extends FlutterCommand {
);
if (argResults['pub']) {
await pubGet(context: PubContext.create, directory: appPath);
await pubGet(context: PubContext.create, directory: appPath, offline: true);
injectPlugins(directory: appPath);
}