Skip to content

Commit 70a8643

Browse files
Merge pull request #23 from FlutterFlow/wenkai/support-environment-argument
Wenkai/support environment argument
2 parents ea250af + a71d04c commit 70a8643

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.22
2+
3+
- Add `--project-environment` option.
4+
15
## 0.0.21
26

37
- Add `--as-debug` option.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ API access is available only to users with active subscriptions. Visit https://a
3232
| `--[no-]parent-folder` | None | [Optional] Whether to download code into a project-named sub-folder. If true, downloads all project files directly to the specified directory. Defaults to `true`. |
3333
| `--[no-]as-module` | None | [Optional] Whether to generate the project as a Flutter module. Defaults to `false`. |
3434
| `--[no-]as-debug` | None | [Optional] Whether to generate the project with debug logging to be able to use FlutterFlow Debug Panel inside the DevTools. Defaults to `false`. |
35-
35+
| `--project-environment` | None | [Optional] Which project environment to be used. If empty, the current environment in the project will be used.|
3636
## Deploy Firebase
3737

3838
### Prerequisites

bin/flutterflow_cli.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void main(List<String> args) async {
5858
fix: parsedArguments.command!['fix'],
5959
exportAsModule: parsedArguments.command!['as-module'],
6060
exportAsDebug: parsedArguments.command!['as-debug'],
61+
environmentName: parsedArguments.command!['project-environment'],
6162
);
6263
break;
6364
case 'deploy-firebase':
@@ -130,6 +131,10 @@ ArgResults _parseArgs(List<String> args) {
130131
help: 'Generate the project with debug logging to be able to use '
131132
'FlutterFlow Debug Panel inside the DevTools.',
132133
defaultsTo: false,
134+
)
135+
..addOption(
136+
'project-environment',
137+
help: '(Optional) Specify a project environment name.',
133138
);
134139

135140
final firebaseDeployCommandParser = ArgParser()

lib/src/flutterflow_api_client.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class FlutterFlowApi {
2626
/// * [format] flag indicates whether to format the exported code.
2727
/// * [exportAsDebug] flag indicates whether to export the code as debug for
2828
/// local run.
29+
/// * [environmentName] is the name of the environment to export the code for.
2930
///
3031
/// Returns a [Future] that completes with the path to the exported code, or
3132
/// throws an error if the export fails.
@@ -36,6 +37,7 @@ class FlutterFlowApi {
3637
required bool includeAssets,
3738
String endpoint = kDefaultEndpoint,
3839
String? branchName,
40+
String? environmentName,
3941
String? commitHash,
4042
bool unzipToParentFolder = false,
4143
bool fix = false,
@@ -70,6 +72,7 @@ Future<String?> exportCode({
7072
required bool exportAsModule,
7173
bool format = true,
7274
String? branchName,
75+
String? environmentName,
7376
String? commitHash,
7477
bool exportAsDebug = false,
7578
}) async {
@@ -86,6 +89,7 @@ Future<String?> exportCode({
8689
endpoint: endpointUrl,
8790
projectId: projectId,
8891
branchName: branchName,
92+
environmentName: environmentName,
8993
commitHash: commitHash,
9094
exportAsModule: exportAsModule,
9195
includeAssets: includeAssets,
@@ -160,6 +164,7 @@ Future<dynamic> _callExport({
160164
required Uri endpoint,
161165
required String projectId,
162166
String? branchName,
167+
String? environmentName,
163168
String? commitHash,
164169
required bool exportAsModule,
165170
required bool includeAssets,
@@ -169,6 +174,7 @@ Future<dynamic> _callExport({
169174
final body = jsonEncode({
170175
'project': {'path': 'projects/$projectId'},
171176
if (branchName != null) 'branch_name': branchName,
177+
if (environmentName != null) 'environment_name': environmentName,
172178
if (commitHash != null) 'commit': {'path': 'commits/$commitHash'},
173179
'export_as_module': exportAsModule,
174180
'include_assets_map': includeAssets,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutterflow_cli
22
description: >-
33
Command-line client for FlutterFlow. Export code from FlutterFlow projects.
4-
version: 0.0.21
4+
version: 0.0.22
55
homepage: https://github.com/FlutterFlow/flutterflow-cli
66
issue_tracker: https://github.com/flutterflow/flutterflow-issues
77

0 commit comments

Comments
 (0)