brianegan / github_search_angular_flutter

Demonstrates how to use the bloc pattern for both an Angular and Flutter app
86 stars 14 forks source link

Grpc-web #1

Open ghost opened 5 years ago

ghost commented 5 years ago

This example uses json.

Grpc-web support landed in the repo,so you can use grpc for flutter and grpc-web for angular.

This is pretty easy to standup with a grpc golang server. So far it works flawlessly.

The only missing bit of the puzzle is how well dart angular supports grpc-web.

Maybe others here might know ?

ghost commented 5 years ago

Looks like it's not just me :)

https://github.com/grpc/grpc-web/issues/213

brianegan commented 5 years ago

Hey there! GRPC would be great -- it's a really cool tech :) That said, I think it's a bit of "out of scope" for this sample, since this relies on the Github API which uses json REST endpoints or GraphQL endpoints.

I haven't seen good support for grpc with AngularDart, but I played with it a couple months ago. Looking at some tickets, it appears it might be in the works though!

Overall, it'd be super easy with this architecture to swap out JSON for GRPC, without any modification in the Angular or Flutter apps. Why? Because all of the logic for coordinating with the github backend is contained inside the data layer. Specifically, the GithubRepository and GithubClient classes.

Therefore, to support GRPC, you could either: change GithubClient to use GRPC instead of http calls, or create a new GithubGrpcClient class and use that in the repository instead of the normal http GithubClient.