Closed ghost closed 6 years ago
Hi! Thanks for your suggestion.
I admit I don't really understand what you mean. Is flutter a web framework? How would this project interface with Flutter? Is Dart able to run in the backend? This project should work with any gRPC server exposed behind the gRPC-Web proxy. Could you expand a little on what it would mean for this project?
sure. Thanks for taking an interest. I was skeptical at first but got grpc between golang and dart going in about 10 minutes. I was knd of stunned how easy it was.
what is Flutter ? https://github.com/flutter/flutter
Show me the Money ?? I want demos :) https://play.google.com/store/apps/details?id=io.flutter.demo.gallery
https://play.google.com/store/apps/details?id=de.aaronoe.moviesflutter
It allows you to build Apps for Mobiles ( and desktops) using only Dart.
Its the basis of google maybe next OS called Fuschia. https://9to5google.com/2018/03/02/fuchsia-friday-first-fuchsia-app/
It supports plugins and you can write them in golang too . https://github.com/flutter/plugins
Most pakcages are here: https://pub.dartlang.org/ even GRPC :) https://pub.dartlang.org/packages/grpc
It has zero dependency on the Native GUi controls. Its actually built on top of skai which is what Google Chome and Xamarim ( spelling) is also build on ironically
Its taking off big time IMHO. Its so easy to write and publish mobiles apps.
YES Dart can run Server side. It can also run on embedded and desktops. I got it running on a Rasp PI3.
Yes you can use GRPC between golang and dart easily. Check out my hacky GRPC golang to DART make file.
# Get golang server and dart client talking over grpc.
# dart Walkthrough : https://grpc.io/docs/tutorials/basic/dart.html
# go equivalent: https://github.com/grpc/grpc-go/tree/master/examples/route_guide
DART_LIBPATH=github.com/grpc/grpc-dart
DART_LIBGOPATH=$(GOPATH)/src/$(DART_LIBPATH)
GO_LIBPATH=google.golang.org/grpc
GO_LIBGOPATH=$(GOPATH)/src/$(GO_LIBPATH)
print:
@echo
@echo DART_LIBPATH $(DART_LIBPATH)
@echo DART_LIBGOPATH $(DART_LIBGOPATH)
@echo
@echo GO_LIBPATH $(GO_LIBPATH)
@echo GO_LIBGOPATH $(GO_LIBGOPATH)
dep-os:
#go get golang.org/x/mobile/cmd/gomobile
#gomobile init # it might take a few minutes
# get the dart protoc plugin
pub global activate protoc_plugin
dep:
go get -u $(GO_LIBPATH)
go get -u $(DART_LIBPATH)
dep-clean:
rm -rf $(DART_LIBGOPATH)
rm -rf $(GO_LIBGOPATH)
## Golang stuff
go-open-code:
code $(GO_LIBGOPATH)/examples/route_guide
go-build:
#cd $(GO_LIBGOPATH)/examples/route_guide && protoc -I protos/ routeguide/route_guide.proto --go_out=grpc:routeguide/generated
cd $(GO_LIBGOPATH)/examples/route_guide/server && go generate
go-run-server:
cd $(GO_LIBGOPATH)/examples/route_guide/server && go run server.go -json_db_file $(GO_LIBGOPATH)/examples/route_guide/testdata/route_guide_db.json -port 8080 -tls=true
go-run-client:
cd $(GO_LIBGOPATH)/examples/route_guide/client && go run client.go -server_addr 127.0.0.1:8080 -tls=true
## Flutter stuff
dart-open-code:
code $(DART_LIBGOPATH)
dart-build:
cd $(DART_LIBGOPATH)/example/route_guide && pub get
# gen dart server
cd $(DART_LIBGOPATH)/example/route_guide && protoc -I protos/ protos/route_guide.proto --dart_out=grpc:lib/src/generated
# gen golang server
#cd $(DART_LIBGOPATH)/example/route_guide && protoc -I protos/ protos/route_guide.proto --go_out=grpc:go/generated
dart-run-server:
# run server
cd $(DART_LIBGOPATH)/example/route_guide && dart bin/server.dart
dart-run-client:
# run server
cd $(DART_LIBGOPATH)/example/route_guide && dart bin/client.dart -tls=true
ft-build-ios:
# do this to bootstrap IOS befroe you start coding.
cd caddy/example && flutter build ios --no-codesign
ft-open-ios:
# open xcode proj.
open caddy/example/ios/Runner.xcworkspace
ft-run-ios:
cd caddy/example && flutter run
What i mean for this project ?
Its more about reusing the Protobufs. You know how other got gopherjs working on top of this ? Well i think the same can be done with Dart / Flutter. Specifically Dart. Like the guy in London did: https://github.com/myitcv/react/wiki/Creating-a-GopherJS-React-app He boot strapped on top of the generated types agian :) Because Reflux is pretty much THE way to manage state on Flutter apps there is good synergy.
There are a couple of ways to skin this cat, but i see pretty amazing potential Ways to skin it:
You can do golang to gomobile over GPRC and then protobufs from the gomobile into Dart and manage all the reflxu at the gomobile level. But thats crazy ?? Well maybe not because you can leverage the same code for web or other things too.
Just golang to Dart over GRPC. Sure thats easy one and pretty cool.
a few other ways i am sure you might think up..
anyway sorry about the Rant. I am playing around with 1 and 2 above and its been pretty nice experience. Its very very early days and this is only being done at nights for me.
Feel free to ask a ton if questions..
I admit I'm still confused exactly what you're proposing here.
Its more about reusing the Protobufs. You know how other got gopherjs working on top of this?
I don't understand. Are you saying I should generate other types? Do you think you could write a concrete proposal? What does this have to do with GopherJS?
Its got nothing to do with gopherjs. Its replacing it with dart / flutter
Ok, while I appreciate the idea, I'm going to close this issue then as this repo is specifically targeted at GopherJS. Maybe we can continue the discussion on slack instead?
I am using grpc with dart alot and flutter. I also use this code and gropherjs. But i am finding flutter a compelling solution where web just does not cut it.
so I am playing around with ideas for codegen from the protobufs all the way up to lots of client code.
I am not asking for this, but more raising the aspect that doing a similar thing with Flutter is a really good fit. For example. Flutter heavily uses the Reflux pattern to get stuff done.
Here is a really good boiler plate to show what i mean: https://github.com/FranPitri/flutter_redux_boilerplate
Here is the codegen approach: https://github.com/davidmarne/built_redux BTW built IS the default way of naming stuff in the dart world that is used for codegen.
NONE of the above are hooked up with GRPC YET ! https://github.com/grpc/grpc-dart Getting golang and dart / flutter talking over pure GRPC is really easy. Been doing that for a while. Its just the normal protoc calls and your flying.