This version is a direct adaptation of the original ar_flutter_plugin (https://pub.dev/packages/ar_flutter_plugin),
migrating the Android component from Sceneform to sceneview_android, enabling the use of animated models.
This fork was created because the original plugin had not been updated since 2022.
➡ Changes include an update to the AR Core endpoint, a gradle upgrade, and compatibility with FlutterFlow.
➡ Migration has been done from sceneform to sceneview_android with the help of Cursor (Ai editor) so maybe some parts are not fully correct (Any contribution is welcome)
❤️ I invite you to collaborate and contribute to the improvement of this plugin.
To contribute code and discuss ideas, create a pull request, open an issue, or start a discussion.
|
|
You can find a complete example running on FlutterFlow here : https://app.flutterflow.io/project/a-r-flutter-lib-ipqw3k |
Add the Flutter package to your project by running:
flutter pub add ar_flutter_plugin_2Or manually add this to your pubspec.yaml file (and run flutter pub get):
dependencies:
ar_flutter_plugin_2: ^0.0.1Or in FlutterFlow :
|
|
Simply add : ar_flutter_plugin_2: ^0.0.1 in pubspecs dependencies of your widget. |
Add this to your code:
import 'package:ar_flutter_plugin_2/ar_flutter_plugin.dart';-
To prevent your application from crashing when launching augmented reality on iOS, you need to add the following permission to the Info.plist file (located under ios/Runner) :
<key>NSCameraUsageDescription</key> <string>This application requires camera access for augmented reality functionality.</string>
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:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# Additional configuration options could already be set here
# BEGINNING OF WHAT YOU SHOULD ADD
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',
# add additional permission groups if required
]
# END OF WHAT YOU SHOULD ADD
end
end
end
In FlutterFlow :
|
|
Unfortunately, at this stage, it is not possible to carry out the procedure above within FlutterFlow. Therefore, it is necessary to publish your project with github and make the modifications manually. And then publish wih Github selected in Deployment Sources : FlutterFlow Publish from Github |
This is a rough sketch of the architecture the plugin implements:
