Skip to content

Sharing code between isolates with FlutterIsolate.spawn #139

@virtualzeta

Description

@virtualzeta

If I use Dart's Isolate.run() method I can send a closure as a computation parameter. If there are non-primitive variables in the closure, these are handled safely but I can't pass them in the message arguments.

In the flutter_isolate package I don't have a similar functionality so I end up in this situation:

  • if I use flutter_isolate I can only send references to top level and static methods, being able to use the native API plugins but I can't use closure;
  • if I use Isolate.run() I can send closures (with data inside that I can't send in the message) but I can't use the native API plugins.

Therefore, is it possible to have a flutterRun() function (similar to flutterCompile()) or a FlutterIsolate.run method (similar to FlutterIsolate.spawn) which allows both to send closure (overcoming the problem of sending non-primitive variables) and at the same time be able to use the FlutterIsolate wrapper which allows me to use native API plugins?

If it were possible, while waiting for this functionality, is it possible now to have a workaround to be able to send closures using the package wrapper?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions