ar_flutter_plugin_flash 1.1.6 copy "ar_flutter_plugin_flash: ^1.1.6" to clipboard
ar_flutter_plugin_flash: ^1.1.6 copied to clipboard

A Flutter plugin for Augmented Reality experiences with native flashlight support. Supports ARKit for iOS and ARCore for Android.

ar_flutter_plugin_flash #

pub package

!!! There is currently a bug in the ARCore library on Android which interferes with the tracking functionality on some devices. To achieve a smooth tracking the app must be built with "debuggable false" in build.gradle. More about it in this github issue: https://github.com/google-ar/arcore-android-sdk/issues/1750 !!!

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

✨ What's new in this version (ar_flutter_plugin_flash)?

  1. Native Flashlight / Torch Support (toggleFlashlight): Standard Flutter flashlight plugins crash with a CAMERA_IN_USE error when AR is active because ARCore/ARKit take exclusive low-level hardware locks on the camera. This plugin solves that by routing the flashlight command directly through the native AR frameworks!
  2. Dynamic UI Toggling (updateVisibilityOptions): You can now dynamically hide or show showFeaturePoints, showPlanes, and showWorldOrigin on the fly without restarting the AR Session. This is perfect for temporarily hiding AR artifacts right before taking a clean snapshot!

Acknowledgements #

This plugin is an extended fork of the excellent ar_flutter_plugin_plus by Franz Graaf, which itself was based on the original ar_flutter_plugin by Lars Carius. 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_flash

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

ar_flutter_plugin_plus package extension #

dependencies:
  ar_flutter_plugin_flash: ^1.1.5

Importing #

Add this to your code:

import 'package:ar_flutter_plugin_flash/ar_flutter_plugin_flash.dart';

If you have problems with permissions on iOS (e.g. with the camera view not showing up even though camera access is allowed), add this to the podfile of your app's ios directory:

    installer.pods_project.targets.each do |target|
      flutter_additional_ios_build_settings(target)
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'

        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
          '$(inherited)',

          ## dart: PermissionGroup.camera
          'PERMISSION_CAMERA=1',

          ## dart: PermissionGroup.photos
          'PERMISSION_PHOTOS=1',

          ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
          'PERMISSION_LOCATION=1',

          ## dart: PermissionGroup.sensors
          'PERMISSION_SENSORS=1',

          ## dart: PermissionGroup.bluetooth
          'PERMISSION_BLUETOOTH=1',

        ]
      end
    end

    # Configure Firebase to use Swift Package Manager
    installer.pods_project.build_configurations.each do |config|
      config.build_settings['FIREBASE_FLUTTER_USE_SPM'] = 'YES'
    end
  end

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 Name Description Link to Code
Debug Options Simple AR scene with toggles to visualize the world origin, feature points and tracked planes Debug Options Code
Local & Online Objects AR scene with buttons to place GLTF objects from the flutter asset folders, GLB objects from the internet, or a GLB object from the app's Documents directory 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 placed. Local & Online Objects Code
Objects & Anchors on Planes AR Scene in which tapping on a plane creates an anchor with a 3D model attached to it Objects & Anchors on Planes Code
Object Transformation Gestures Same as Objects & Anchors on Planes example, but objects can be panned and rotated using gestures after being placed Object Transformation Gestures Code
Screenshots Same as Objects & Anchors on Planes Example, but the snapshot function is used to take screenshots of the AR Scene Screenshots Code
Cloud Anchors AR 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 anchors Cloud Anchors Code
External Object Management Similar 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 format External Model Management Code
Image Tracking The developer can provide a list of images that are recognized when they appear in the camera image of the AR scene. The position and rotation of the image is recognized and can be used to place 3D objects in the scene. Image Tracking Code

Contributing #

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

Plugin Architecture #

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

ar_plugin_architecture

0
likes
140
points
304
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for Augmented Reality experiences with native flashlight support. Supports ARKit for iOS and ARCore for Android.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, geolocator, json_annotation, permission_handler, vector_math

More

Packages that depend on ar_flutter_plugin_flash

Packages that implement ar_flutter_plugin_flash