dimx_flutter_sdk 0.1.1-rc1
dimx_flutter_sdk: ^0.1.1-rc1 copied to clipboard
Flutter plugin for the DimensionX mobile SDK: opens DimensionX AR experiences and their web pages from a Flutter app on Android and iOS.
dimx_flutter_sdk #
Flutter plugin for the DimensionX mobile SDK on Android and iOS: open a DimensionX AR experience, or its web page, from a Flutter app.
import 'package:dimx_flutter_sdk/dimx_flutter_sdk.dart';
final dimx = DimxPlugin();
await dimx.initializeDimxSdk({
'qrCodeEnabled': true,
'sharePhotoEnabled': true,
'shareVideoEnabled': false,
'webVersionUrl': 'https://app.dimx.world/version',
'defaultAppUrl': 'https://go.dimx.world',
'appScreenActivity': 'com.example.my_app.MainActivity', // Android
});
await dimx.showARScreen('https://go.dimx.world/?dim=3358080808&loc=2134961551&live=1&place=1');
await dimx.showWebScreen('https://go.dimx.world/?dim=3358080808');
The plugin wraps the two native SDKs at one version - dimx-android-sdk
from the maven repository on dl.dimx.world and dimx-ios-sdk
as a Swift package - and the plugin's version is the SDK release it is
built against. The full documentation is at https://docs.dimx.world.
Installation #
flutter pub add dimx_flutter_sdk
Android #
-
Add the maven repository the native SDK is served from to the app's repositories (
android/build.gradle.kts, underallprojects):allprojects { repositories { google() mavenCentral() maven { url = uri("https://dl.dimx.world/sdk/android") } } }Declaring it only in the plugin is not enough: Gradle resolves a plugin's dependencies with the consuming app's repositories, and without it the build fails with
Could not find world.dimx:dimx-android-sdk. -
minSdk 28inandroid/app/build.gradle.kts: the SDK needs ARCore, which needs Android 9. The SDK's dependencies need Android Gradle plugin 8.9.1 or newer andcompileSdk 36, which current Flutter templates satisfy. -
Pass your
MainActivity, fully qualified, asappScreenActivity: it is where the SDK returns when its own screens close.
The camera and location permissions the AR screen needs come from the SDK's
manifest and are requested by initializeDimxSdk; a refusal fails it with
PERMISSION_DENIED.
iOS #
The plugin is a Swift package, because the native SDK is one: its engine ships as binary targets a Swift package resolves, which CocoaPods cannot do. So the app has to build its plugins through Swift Package Manager - the default since Flutter 3.44; on Flutter 3.24 to 3.43 turn it on once:
flutter config --enable-swift-package-manager
Then:
- iOS 16.4 or newer (
platform :ios, '16.4'in the Podfile if one remains, and the deployment target in Xcode). - Usage descriptions in
Info.plistfor the camera (NSCameraUsageDescription), location when in use (NSLocationWhenInUseUsageDescription), the photo library (NSPhotoLibraryUsageDescription) and Bluetooth (NSBluetoothAlwaysUsageDescription, for beacon ranging). - A real device: the SDK ships device-only binaries, so the simulator is not a destination.
On iOS the SDK asks for the permissions itself when the AR screen opens; a refused camera shows the SDK's alert with a way to Settings and returns to the app.
Example #
example/ is the plugin's own development app, depending on the plugin by
path. A sample app that consumes the published plugin the way your app
would is in dimx-sdk-samples
under flutter/.
flutter pub get
cd example
flutter pub get
flutter run