Skip to content

Commit 344cb15

Browse files
authored
Add support for downloading the code from download_url (#31)
* Add support for downloading the code from download_url * Bump version to 0.0.29 * Print stderr if buildProject fails * Bump Flutter version to 3.32.4 and Dart version to 3.8.1 in integ tests
1 parent cb874ab commit 344cb15

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ on: push
33

44
env:
55
# Keep this in sync with the version used by FlutterFlow.
6-
DART_VERSION: 3.6.1
7-
FLUTTER_VERSION: 3.27.3
6+
DART_VERSION: 3.8.1
7+
FLUTTER_VERSION: 3.32.4
88

99
jobs:
1010
check:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.29
2+
3+
- Add support for download_url.
4+
15
## 0.0.28
26

37
- Update path version.

lib/src/flutterflow_api_client.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,16 @@ Future<String?> exportCode({
103103
exportAsDebug: exportAsDebug,
104104
);
105105
// Download actual code
106-
final projectZipBytes = base64Decode(result['project_zip']);
106+
final List<int> projectZipBytes;
107+
if (result['download_url'] != null) {
108+
final response = await client.get(Uri.parse(result['download_url']));
109+
if (response.statusCode != 200) {
110+
throw 'Failed to download project zip from URL: ${response.statusCode}';
111+
}
112+
projectZipBytes = response.bodyBytes;
113+
} else {
114+
projectZipBytes = base64Decode(result['project_zip']);
115+
}
107116
final projectFolder = ZipDecoder().decodeBytes(projectZipBytes);
108117

109118
extractArchiveTo(projectFolder, destinationPath, unzipToParentFolder);

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.28
4+
version: 0.0.29
55
homepage: https://github.com/FlutterFlow/flutterflow-cli
66
issue_tracker: https://github.com/flutterflow/flutterflow-issues
77

test/integration_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Future<bool> buildProject(String project) async {
1212
var result = await Process.run('flutter', ['build', 'web'],
1313
workingDirectory: p.normalize(project), runInShell: true);
1414

15+
if (result.exitCode != 0) {
16+
stderr.writeln(result.stderr);
17+
}
18+
1519
return result.exitCode == 0;
1620
}
1721

0 commit comments

Comments
 (0)