grpc-dart
grpc-dart copied to clipboard
Support creating client with Streams
It is easier to invoke golang code from flutter code. Due to less ios/android code and class-struct mapping, coding errors will be reduced.
Not sure what you mean. Can you be more detailed ?
When calling golang api from flutter, currently we must write the ios/android version api for every golang api. If it is possible to create grpc client using stream and sink(currently only accept ip:port), we can make dart-golang calls easier, because we only need to establish a virtual connection(stream and sink) to golang code through the platform channel. The android/ios code do not need to be changed when a golang api changes. I'm sorry for my poor English.
now i understand what you mean. You want to run golang inside flutter ?
Yes. And i want to make it more easier to maintain for me. I am not familiar with android/ios, so I want make the the platform code to be decoupled from the business.
What you're asking for is not doable yet due to limitation in Flutter, not grpc-Dart. This is evident by the discussion in Flutter in the links below:
https://github.com/flutter/flutter/issues/2396
https://github.com/flutter/flutter/issues/7053
Yes, flutter call C/C++ directly is impossible. But using platform channel to only pass binary data is feasible.
I created a flutter plugin, which can create a pair of (StreamSink<List
// 9999 is not a system port.
// golang: ln,err := forgo.Listen(9999)
_conn = await Conn.dial(9999);
_conn.done.then((_) {
_conn.close();
});
_transport = ClientTransportConnection.viaStreams(_conn.receiveStream, _conn);
So i need a way to create grpc client from that _transport or _conn.
https://github.com/flutter/flutter/issues/7053 has now been solved btw !!!