-
-
Save richard-flosi/8b43c06732d296f1145b8f5d12bf194e to your computer and use it in GitHub Desktop.
#!/bin/sh | |
FLUTTER_BRANCH=`grep channel: .metadata | sed 's/ channel: //g'` | |
FLUTTER_REVISION=`grep revision: .metadata | sed 's/ revision: //g'` | |
git clone https://github.com/flutter/flutter.git | |
cd flutter | |
git checkout $FLUTTER_BRANCH | |
git pull origin $FLUTTER_BRANCH | |
git checkout $FLUTTER_REVISION | |
cd .. | |
flutter/bin/flutter config --enable-web | |
flutter/bin/flutter build web |
[build] | |
command = "./flutter-netlify-build.sh" | |
publish = "build/web" |
Can you please share your new methodology?
I created a new gist to demonstrate here:
https://gist.github.com/richard-flosi/766040cec9bd2ea5da7a33bc01706de4
Hi there ! I'm pretty new to Flutter Web and Netlify and was wondering if perhaps you knew any resources that could explain this process ! How-to setup netlify with build scripts !
how can i generate .g.dart files while deploying??
how can i generate .g.dart files while deploying??
I'm not sure myself, but it looks like this issue may address your question: google/json_serializable.dart#581
See comment here: google/json_serializable.dart#581 (comment)
How to fix this error: 12:18:29 PM: Exception: Failed to compile application for the Web.
12:18:29 PM:
12:18:29 PM: build.command failed
12:18:29 PM: ────────────────────────────────────────────────────────────────
12:18:29 PM:
12:18:29 PM: Error message
12:18:29 PM: Command failed with exit code 1: if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release (https://ntl.fyi/exit-code-1)
12:18:29 PM:
12:18:29 PM: Error location
12:18:29 PM: In Build command from Netlify app:
12:18:29 PM: if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release
12:18:29 PM:
12:18:29 PM: Resolved config
12:18:29 PM: build:
12:18:29 PM: command: if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release
12:18:29 PM: commandOrigin: ui
12:18:29 PM: environment:
12:18:29 PM: - REVIEW_ID
12:18:29 PM: publish: /opt/build/repo/build/web
12:18:29 PM: publishOrigin: ui
12:18:31 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:18:31 PM: Failing build: Failed to build site
12:18:32 PM: Finished processing build request in 1m21.142s
@fisforfaheem This example is pretty old now and it looks like Netlify is reporting your build failed. I'd probably work on getting the build to work locally first and there is probably a better way to do this now. Have you read through the Flutter web docs here? https://docs.flutter.dev/platform-integration/web/building
i tried
Here is the build script I just used to launch a new flutter web site on netlify:
build.sh