I'm trying Flutter AR app for cross platform, is it possible to use both plugin in a single app. With single code base(ARKit code) will it work for android platform and vise versa or do we need to work independently for individual platform ?
dependencies:
arcore_flutter_plugin: ^0.0.2+1
arkit_plugin: ^0.3.0
Plugin Architecture Flutter Plugin for creating (collaborative) Augmented Reality experiences - Supports ARKit for iOS and ARCore for Android devices.
ARKit tends to perform better than ARCore in terms of image tracking and recognition. If you intend to create AR apps that track user gestures to manipulate on-screen images, ARKit will usually be the more efficient option. It translates movements into data faster than Google's alternative.
In this tutorial, you'll learn about how to build an augmented reality app in Flutter with a plugin that supports both Android and iOS devices. An AR app adds data or visuals to your experience on your camera. Popular examples include Instagram filters, Snapchat filters, various map apps, and more.
Yes, I have managed to combine both plugins in one flutter app so that ARCore runs on Android devices and ARKit on iOS.
To get started, just follow the tutorials to create an arkit app and an arcore app. Then create a new flutter project with both plugins. For the first version, I put the arkit_plugin code in a class I called ArCoreState (extending State for the app) and the arcore_flutter_plugin code in another class, ArKitState.
The main.dart was then simply
void main() => runApp(MaterialApp(home: MultiPlatformApp()));
class MultiPlatformApp extends StatefulWidget {
@override State<StatefulWidget> createState() =>
Platform.isAndroid ? ArCoreState() : ArKitState();
}
When you have that running, you have a cross platform AR app, even if it has only one single line of shared code!
I know this has been asked a while ago now, but the problem is still unchanged.
To everyone ending up here because they are trying to develop a cross-platform AR app with Flutter: Check out this GitHub Issue Thread.
Among others, I'm currently working on a Flutter plugin that supports both ARCore and ARKit with a common interface, so people can write proper cross-platform apps with shared code and functionality. I'll be posting updates into the GitHub discussion linked above!
EDIT
The plugin is now available at: https://pub.dev/packages/ar_flutter_plugin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With