Skip to content

IPC schema/codegen system for platform↔flutter and isolate↔isolate interop #32930

@xster

Description

@xster

Using the current platform channel mechanism manually is fine for 'primitive' types and a small number of methods, but for complex data heavy plugins (firebase?) and add-to-app where we need to pass complex business logic data through potentially dozens of IPC APIs, the boilerplate can be very unsafe (untyped) and unergonomic.

Explore making this process schemafiable via an IDL and send/receive APIs + data classes code-generated on Dart/Kotlin/Swift etc.

First thoughts:

  • The gRPC schema .protos seems like a great format. But it's not clear whether the gRPC implementation libraries are modular enough to replace parts other than the serialization mechanism. e.g. we don't want any HTTP2, timeout propagation logic. Is it valuable enough still if we only want the gRPC specs and not its implementation?
  • FlatBuffers might not be enough. We want both a data-class codegen mechanism and an IPC API codegen mechanism. Half of the pain comes from writing channel methods, spelling out the method names in strings, handling non-existent method names etc etc.
  • FIDL could be promising. Not clear enough from reading the docs.

Edit:

This IDL should support bidirectional channels and ideally support streams so users can easily implement observables across plugins/modules.

For instance, if I have a Profile class instance that I dependency inject into native screens and also sent to Flutter, I should ideally be able to call a setter on the Profile.isLoggedIn property and trigger observers in both native screens and Flutter without calling any other imperative functions.

Related #24080

Metadata

Metadata

Assignees

Labels

a: existing-appsIntegration with existing apps via the add-to-app flowc: new featureNothing broken; request for a new capabilitycustomer: handp: pigeonrelated to pigeon messaging codegen tool

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions