Ahmed Ibrahim
Ahmed Ibrahim

Reputation: 751

Why does Flutter ship the Skia engine despite using AOT compilation to native code?

I'm currently exploring Flutter's architecture and compilation process, and I'm a bit puzzled by the presence of the Skia engine even when Flutter uses AOT (Ahead-of-Time) compilation to generate native machine code.

As far as I understand, AOT compilation should convert the Dart code into native code, However, I noticed that Flutter still ships the Skia engine

I'd like to understand the reasoning behind this design decision. Why does Flutter need the Skia engine when it already compiles the Dart code to native machine code? What benefits does Skia provide in conjunction with AOT compilation? Are there specific performance or cross-platform considerations that make the inclusion of Skia?

Upvotes: 1

Views: 333

Answers (2)

DevDin
DevDin

Reputation: 46

Skia is an alternative to openGL which is already there on Android.Skia takes care of rendering every flutter widget on to the screen like how openGL does for native android development. hence, pre-compiled Skia binary is packaged into APK and invoked to render the UI. Hope this is clear.

Upvotes: 0

RodXander
RodXander

Reputation: 843

Every OS supports different graphic APIs: DirectX, OpenGL, Metal, Vulkan, etc. Skia, a cross-platform graphic engine, allows the Flutter engine to agnostically interact with all these APIs without having to individually support them.

That's all coming to an end though, since they introduced Impeller, which doesn't use it and directly communicates with the underlying API.

Upvotes: 0

Related Questions