Skip to content

autifyhq/flutter-grpc-proxy-exaple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Hello Server & Flutter Client

Go gRPC server with Flutter client using real Protocol Buffers.

Quick Start

# Terminal 1: Start Go server
cd server && go run main.go

# Terminal 2: Run Flutter app
cd flutter_app
fvm install 3.24.5 && fvm use 3.24.5
fvm flutter pub get && fvm flutter run

Project Structure

├── proto/hello.proto          # gRPC service definition
├── proto/*.pb.go              # Generated Go code
├── server/main.go             # Go gRPC server
├── server/test_client.go      # Go test client
└── flutter_app/
    ├── lib/main.dart          # Flutter app
    └── lib/generated/         # Generated Dart code

Server

Prerequisites: Go 1.23+

cd server
go run main.go                 # Starts on :50051
go run test_client.go          # Test with Go client

Flutter App

Prerequisites: Flutter 3.24.5+ (managed with FVM)

cd flutter_app
fvm flutter run               # Connect to localhost:50051

Features: Host/port input, gRPC communication, real-time logs, proxy support, system proxy auto-detection.

Troubleshooting:

  • iOS simulator: use localhost
  • Android emulator: use 10.0.2.2

Build APK

Build Android APK for distribution:

cd flutter_app
fvm flutter build apk --release    # Creates app-release.apk (20.9MB)

Generated APK location: build/app/outputs/flutter-apk/app-release.apk

Protocol

service Greeter {
  rpc SayHello (HelloRequest) returns (HelloResponse);
}

message HelloRequest {
  string name = 1;
}

message HelloResponse {
  string message = 1;
  string client_ip = 2;
  string user_agent = 3;
  string timestamp = 4;
}

Regenerating Code

Go:

protoc --go_out=. --go-grpc_out=. proto/hello.proto

Dart: Due to SDK compatibility issues, manually update lib/generated/ files when proto changes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •