Closed ghost closed 6 years ago
Again, Thanks for your suggestion :100:,
Android -> Flutter
side. If Unilinks gets ported having the GoFlutter embedder compatible with Fluro would be the best. (I have no idea how the Android intent
is handled on the embedder side)hey @Drakirus thanks for considering my suggestions.
i think the last comment is the most important. How are plugins loaded ? Options are:
Shared libs: https://medium.com/learning-the-go-programming-language/writing-modular-go-programs-with-plugins-ec46381ee1a9
RPC: RPC is doable but slow. Hashicorp uses this approach. https://github.com/hashicorp/go-plugin
So far i see nothing to really help. Right now i feel like its best to actually support BO
Compiled in:
What i would prefer is to use interfaces to support both RPC and Compiled in plugins. Its sort of a have both if you need it option. Luckily the Hashicorp package uses plain golang interfaces too so its easy to support both using Inversion of Control pattern. Why both ? I think that most devs will use Compiled in, but i think there are uses cases where some devs will want to allow plugins to be added at runtime. I also want to stress that an amazing newbie user experience is possible because users can add plugins by just using configuration, without having to recompile flutter and golang. To me that quite a powerful thing. Hashicorp even has a "go-getter" to do just that ( in their Readme ). Also in general any system that supports ruintime plugin addition becomes useful in use cases you can only really imagine. For instance if VSCODE did not allow runtime plugins plugins it would be useless as a Product. So what i am really saying is that Flutter desktop could be hugely popular if it supported runtime plugins.
my 2 cents Summary: Support compile time initially with a view to runtime soon after.
--
Regarding the Printing....
The idea with screen scraping is to take a screen grab of the flutter screen. Thats all. I know of a golang lib that does that very well. However, it means that the resolution though is only screen resolution and so will look bad when printed. Its a terrible option. What i am hoping for is what you get with the web, in that when you built a web app it magically is able to be printed as vectors, and thats really awesome because you don't have to rewrite all your screens to support vector based printing. At the moment in Flutter the only way to Print is to write code to generate a PDF and then send that to a Printer - so you have to write your View twice.
Did you see this ?
https://github.com/adieu/flutter_go
It's a way to plugin golang into flutter on mobile.
It's simple and works with zero messing around with java or objective c.
This is what might be cool for desktop I was thinking.
Then using g your your golang lib between mobile and desktop is the same
The jaguer library for dart is what I use for the dart side. Very nice code and we'll done.
This also allows you to use the same RPC approach between flutter client and a golang server somewhere else physically too.
For 3d stuff though plugging directly in is probably better. Like what the ebiten project does with golang on mobile.
Food for thought ?
now there is a grpc approach also. https://github.com/empirefox
Quite nice since it supports both gomobile and go. So can be used for Mobiles and Desktops.
Those golang libs are looking good. But they are kind of niche. I don't see many cases where you would use those 'codec' instead of the ones that are already exposed.
A lot of work needs to be done to implement the StandardMethodCodec
and JSONMethodCodec
which are used by most of the library maker. The goal is to support those codecs so that we can plug the embedder to already existing flutter libs.
Did you see the JSON RPC one ?
Here is my make file for it:
ROOTLIB=github.com/renatoathaydes
ROOTLIB_FSPATH=$(GOPATH)/src/$(ROOTLIB)
LIB=github.com/renatoathaydes/go-hash
LIB_FSPATH=$(GOPATH)/src/$(LIB)
MOB_LIB=github.com/renatoathaydes/gohash_mobile
MOB_LIB_FSPATH=$(GOPATH)/src/$(MOB_LIB)
FL_LIB=github.com/renatoathaydes/gohash_mobile_app
FL_LIB_FSPATH=$(GOPATH)/src/$(FL_LIB)
print:
@echo
@echo ROOTLIB -
@echo ROOTLIB :$(ROOTLIB)
@echo ROOTLIB_FSPATH : $(ROOTLIB_FSPATH)
#cd $(LIB_FSPATH) && ls -al
@echo
@echo LIB -
@echo LIB :$(LIB)
@echo LIB_FSPATH : $(LIB_FSPATH)
#cd $(LIB_FSPATH) && ls -al
@echo
@echo MOB_LIB -
@echo MOB_LIB :$(MOB_LIB)
@echo MOB_LIB_FSPATH : $(MOB_LIB_FSPATH)
#cd $(LIB_FSPATH) && ls -al
@echo
@echo Flutter LIB -
@echo FL_LIB :$(FL_LIB)
@echo FL_LIB_FSPATH : $(FL_LIB_FSPATH)
#cd $(LIB_FSPATH) && ls -al
@echo
@echo
dep:
cd $(ROOTLIB_FSPATH) && git clone https://$(LIB).git
cd $(ROOTLIB_FSPATH) && git clone https://$(MOB_LIB).git
cd $(ROOTLIB_FSPATH) && git clone https://$(FL_LIB).git
dep-os:
# Setup gomobile properly
# gomobile init. Must use the NDK bundle
gomobile init -ndk $(ANDROID_NDK)
dep-update:
# get latest code from git
cd $(LIB_FSPATH) && git pull
cd $(MOB_LIB_FSPATH) && git pull
cd $(LIB_FSPATH) && git pull
# update its deps ( needed due to golang 1.11 )
#cd $(LIB_FSPATH) && dep ensure -update
# update flutter code
cd $(MOB_LIB_FSPATH) && flutter packages upgrade
cd $(FL_LIB_FSPATH) && flutter packages upgrade
dep-clean:
cd $(ROOTLIB_FSPATH) && rm -rf *
code:
code $(ROOTLIB_FSPATH)
###
ex-run:
flutter emulators --launch Nexus_5X_API_27
flutter emulators --launch apple_ios_simulator
cd $(MOB_LIB_FSPATH)/example && flutter run -d all
ex-build:
# build desktop libs
#cd $(LIB_FSPATH) && make release
# build mobile libs
# this is not needed for Flutter because gradle is setup to do it.
#gomobile bind -target=android $(LIB)/mobileapi
#gomobile bind -target=ios $(LIB)/mobileapi
cd $(MOB_LIB_FSPATH)/example && flutter build apk
# IOS needs a proper provisioning profile to match the name. Have to make it in the Apple Web gui.
cd $(MOB_LIB_FSPATH)/example && flutter build ios
run:
flutter emulators --launch Nexus_5X_API_27
flutter emulators --launch apple_ios_simulator
cd $(FL_LIB_FSPATH) && flutter run -d all
Yup I did saw it, but for now, I only want to keep the standard related work in this repo. Another golang lib could be made later to bridge their stuff into this project.
ok, makes sense :)
I just made a PR #20 Any through ?
Fixed with: #20 and #25
These are two desktop services I am thinking of adding and I want feedback
Notifications. There are good golang packages for this so should be easy to do native notification.
Unilinks is when a user gets an email with a deeplinking into the flutter app. When they click the link it opens the flutter app and routes into the link. Unilinks is the name of the flutter for mobile plugin and so we can reuse the Dart code and replace the java and objective c with golang. I am not sure what's already out there in terms of golang libs for this but I am confident it's doable.
Printing Dart has pdf gen but golang has great pdf gen. Assuming we want to go with the PDF approach ? Other way is to take a screen Scape raster image and bundle it inside a pdf. Both are useful. Then there is sending it to a printer. There are some decent golang libs for this.
If I can get feedback, and I will start working on these.