A new Flutter project.
To make it works with GRPC you need to Disable CORS
- Go to flutter\bin\cache and remove a file named: flutter_tools.stamp
rm ~/snap/flutter/common/flutter/bin/cache/flutter_tools.stamp
- Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart. (for linux is at
vi ~/snap/flutter/common/flutter/packages/flutter_tools/lib/src/web/chrome.dart
- Find '--disable-extensions'
- Add '--disable-web-security',
flutter run -d chrome --web-port=4200 --web-renderer=html
This project is a starting point for a Flutter application.
- Download binary from here
- unzip to /usr/lib/protoc-xxxx
-
ln -s /usr/lib/protoc-xxxx protoc
- edit /etc/profile
- add PROTOC_PATH pointing to /usr/lib/protoc and export it
- add $PROTOC_HOME/bin in PATH
- Download binary from here
$ sudo mkdir protoc-gen-grpc-web-xxx
$ sudo mkdir protoc-gen-grpc-web-xxx/bin
$ sudo mv ~/Downloads/protoc-gen-grpc-web-xxx /usr/lib/protoc-gen-grpc-web-xxx/bin/protoc-gen-grpc-web
$ sudo chmod +x /usr/lib/protoc-gen-grpc-web-xxx/bin/protoc-gen-grpc-web-xxx
$ sudo ln -s /usr/lib/protoc-gen-grpc-web-xxx /usr/lib/protoc-gen-grrc-web
- edit /etc/profile
- add PROTOC_WEB_PATH pointing to /usr/lib/protoc_web and export it
- add $PROTOC_WEB_HOME/bin in PATH
- edit ~/.bashrc
- add
~/.pub-cache/bin
to your PATH,
- add
$ mkdir lib/grpc_stub
$ protoc --dart_out=grpc:lib/grpc_stub/ -I./protos ./protos/*.proto google/protobuf/timestamp.proto
$ mkdir -p js/dist/proto
$ protoc -I . echo.proto --js_out=import_style=commonjs:./js/dist/proto --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./js/dist/proto