Skip to content

Commit 0d134d8

Browse files
authored
Support export as debug for FlutterFlowApi (#21)
* Support export as debug * Add a check for whether both `exportAsModule` and `exportAsDebug` true
1 parent 9781a51 commit 0d134d8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/src/flutterflow_api_client.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class FlutterFlowApi {
2424
/// * [fix] flag indicates whether to fix any issues in the exported code.
2525
/// * [exportAsModule] flag indicates whether to export the code as a module.
2626
/// * [format] flag indicates whether to format the exported code.
27+
/// * [exportAsDebug] flag indicates whether to export the code as debug for
28+
/// local run.
2729
///
2830
/// Returns a [Future] that completes with the path to the exported code, or
2931
/// throws an error if the export fails.
@@ -38,6 +40,7 @@ class FlutterFlowApi {
3840
bool fix = false,
3941
bool exportAsModule = false,
4042
bool format = true,
43+
bool exportAsDebug = false,
4144
}) =>
4245
exportCode(
4346
token: token,
@@ -50,6 +53,7 @@ class FlutterFlowApi {
5053
fix: fix,
5154
exportAsModule: exportAsModule,
5255
format: format,
56+
exportAsDebug: exportAsDebug,
5357
);
5458
}
5559

@@ -64,7 +68,11 @@ Future<String?> exportCode({
6468
required bool exportAsModule,
6569
bool format = true,
6670
String? branchName,
71+
bool exportAsDebug = false,
6772
}) async {
73+
if (exportAsDebug && exportAsModule) {
74+
throw 'Cannot export as module and debug at the same time.';
75+
}
6876
final endpointUrl = Uri.parse(endpoint);
6977
final client = http.Client();
7078
String? folderName;
@@ -78,6 +86,7 @@ Future<String?> exportCode({
7886
exportAsModule: exportAsModule,
7987
includeAssets: includeAssets,
8088
format: format,
89+
exportAsDebug: exportAsDebug,
8190
);
8291
// Download actual code
8392
final projectZipBytes = base64Decode(result['project_zip']);
@@ -150,6 +159,7 @@ Future<dynamic> _callExport({
150159
required bool exportAsModule,
151160
required bool includeAssets,
152161
required bool format,
162+
required bool exportAsDebug,
153163
}) async {
154164
final body = jsonEncode({
155165
'project': {
@@ -159,6 +169,7 @@ Future<dynamic> _callExport({
159169
'export_as_module': exportAsModule,
160170
'include_assets_map': includeAssets,
161171
'format': format,
172+
'export_as_debug': exportAsDebug,
162173
});
163174
return await _callEndpoint(
164175
client: client,

0 commit comments

Comments
 (0)