Flutter Plugin for AR (Augmented Reality)

  Plugin, plugin

ar_flutter_plugin

Flutter Plugin for (collaborative) Augmented Reality – Supports ARKit for iOS and ARCore for Android devices.

Many thanks to Oleksandr Leuschenko for the arkit_flutter_plugin and to Gian Marco Di Francesco for the arcore_flutter_plugin which both served as a great basis and starting point for this project.

Getting Started

Installing

Add the Flutter package to your project by running:

flutter pub add ar_flutter_plugin

Or manually add this to your pubspec.yaml file (and run flutter pub get):

dependencies:
  ar_flutter_plugin: ^0.4.3

Importing

Add this to your code:

import 'package:ar_flutter_plugin/ar_flutter_plugin.dart';

Example Applications

To try out the plugin, it is best to have a look at one of the following examples implemented in the Example app:

Example NameDescriptionLink to Code
Debug OptionsSimple AR scene with toggles to visualize the world origin, feature points and tracked planesDebug Options Code
Local & Online ObjetsAR scene with buttons to place GLTF objects from the flutter asset folders or GLB objects from the internet at a given position, rotation and scale. Additional buttons allow to modify scale, position and orientation with regard to the world origin after objects have been placedLocal & Online Objects Code
Objects & Anchors on PlanesAR Scene in which tapping on a plane creates an anchor with a 3D model attached to itObjects & Anchors on Planes Code
Cloud AnchorsAR Scene in which objects can be placed, uploaded and downloaded, thus creating an interactive AR experience that can be shared between multiple devices. Currently, the example allows to upload the last placed object along with its anchor and download all anchors within a radius of 100m along with all the attached objects (independent of which device originally placed the objects). As sharing the objects is done by using the Google Cloud Anchor Service and Firebase, this requires some additional setup, please read Getting Started with cloud anchorsCloud Anchors Code
External Object ManagementSimilar to the Cloud Anchors example, but contains UI to choose between different models. Rather than being hard-coded, an external database (Firestore) is used to manage the available models. As sharing the objects is done by using the Google Cloud Anchor Service and Firebase, this requires some additional setup, please read Getting Started with cloud anchors. Also make sure that in your Firestore database, the collection “models” contains some entries with the fields “name”, “image”, and “uri”, where “uri” points to the raw file of a model in GLB formatExternal Model Management Code

Contributing

Contributions to this plugin are very welcome. To contribute code and discuss ideas, create a pull requestopen an issue, or start a discussion.

Plugin Architecture

This is a rough sketch of the architecture the plugin implements:

ar_plugin_architecture
pub package

Download Flutter Plugin for AR source code on GitHub

https://github.com/CariusLars/ar_flutter_plugin