What is the difference between Flutter Android Embedding V1 and V2
Asked Answered
M

1

13

I am working on a plugin for Flutter with background stuff.
Recently, I faced somethings about Flutter android embedding in the android_alarm_manager plugin.

A part of the README says:

For the Flutter Android Embedding V1, the background service must be provided a callback to register plugins with the background isolate.

  • What exactly is Flutter android embedding V1 or V2?
  • What are the differences between these two?
Mccaskill answered 30/1, 2020 at 14:26 Comment(1)
Flutter project leser that 1.12 having V1 and from 1.12 with new V2 Android platform-side wrappers. github.com/flutter/flutter/wiki/…Overglaze
M
5

According to docs:

In order to better support the execution environments of adding Flutter to an existing project, the old Android platform-side wrappers hosting the Flutter runtime at io.flutter.app.FlutterActivity and their associated classes are now deprecated. New wrappers at io.flutter.embedding.android.FlutterActivity and associated classes now replace them.

Those classes better support real world scenarios where the FlutterActivity isn't the first and only Android Activity in an application.

The embedded v2 provides better support for things like background execution (firebase messaging for instance. Checkout the changeLog).

If you are developing a plugin, you should consider starting with embedded v2. Existing packages are already migrated or migrating.

Mccaskill answered 10/2, 2020 at 8:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.