Sdk: Compile dart to Android aar or iOS framework without using Flutter

Created on 11 Jul 2020  路  4Comments  路  Source: dart-lang/sdk

Is it possible to compile dart to native Android and iOS without using flutter dependency.

Currently I can create Flutter Module and compile it to an aar or ios framework. But this also bundles some Flutter dependency.

Can it be done with pure dart like how kotlin native does it.

Use Case:

  • Sharing the business logic between existing Android and iOS application.
area-vm type-question

All 4 comments

The same AOT compiler that flutter uses is also available as a standalone tool, which can compile non-Flutter apps. Though to run such an AOT compiled application, one needs a runtime system (containing garbage collector, runtime type system, ...). We do have a command line AOT runtime (Dart SDKs ship with dart2native and dartaotruntime).

Though right now we don't provide a custom, non-flutter embedder that can be loaded dynamically into Android/iOS apps (i.e. the analogue of libflutter.so). Though it would be possible to build such an embedder using the Dart VM's embedder API.

We don't have plans atm to provide it, maybe that will change in the Future.

/cc @mit-mit @mraleph @a-siva

Hi @mkustermann

Thanks for the information.
Hope to see this feature implemented sometime in future :)

As @mkustermann notes, there is nothing stopping someone else from doing this via the same mechanisms Flutter uses. :-)

Given that this is not planned for short term, I am just going to close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sgrekhov picture sgrekhov  路  3Comments

jmesserly picture jmesserly  路  3Comments

DartBot picture DartBot  路  3Comments

Hixie picture Hixie  路  3Comments

55555Mohit55555 picture 55555Mohit55555  路  3Comments