Skip to content

(Will PR) Make native code super thin? #1527

@fzyzcjy

Description

@fzyzcjy

Hi thanks for the helpful package! I wonder whether it is possible to make native code super thin? Currently it is already not heavy, but bugs are still there (e.g. #1523) for the glue code.

Just a naive thought: Is it possible that, we move almost all logic from native side to Dart side. The native side only remains simplest primitive things.

Direct bugs that it can eliminiate:

By the way, even if Dart->Java call is async, we can still ensure commands are executed serially, by ensuring one command is finished before sending second command.

Cons:

  • Code latency will be larger. For example, originally the onCompletion will cause several operations on MediaPlayer by direct android code execution, but now it is implemented by back-and-forth between Dart and Android. This may or may not be a problem for low-latency scenarios. For example, if the critical path is not affected by this, then it is OK. We can also alleviate this by allowing one Dart-to-native call to execute multiple things.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions