deepar_flutter_perfect 0.0.3 copy "deepar_flutter_perfect: ^0.0.3" to clipboard
deepar_flutter_perfect: ^0.0.3 copied to clipboard

DeepAR Flutter plugin with full support for all Android devices—including Xiaomi—and iOS. Easily load AR effects from assets, file paths, or URLs for smooth, reliable performance everywhere.

deepar_flutter_perfect #

An enhanced Flutter plugin based on the official DeepAR SDK, providing robust support for loading AR effects from assets, file paths, and URLs with automatic caching. This enables loading effects stored locally or directly from the internet, ensuring smooth AR experiences on all Android devices—including Xiaomi—and iOS.

This plugin is a fork of the official DeepAR Flutter SDK. Supported platforms: Android (SDK 23+) and iOS (13.0+).


Features #

  • Load AR effects from assets, file paths, and remote URLs with caching ✨ (New!)
  • Live AR preview ✅
  • Take screenshots ✅
  • Record videos ✅
  • Flip camera ✅
  • Toggle flash ✅

Android SDK 23+


Breaking Changes #

  • v0.1.7: The initialize() method now returns an InitializeResult object with success and message properties (not just a boolean). See Flutter usage for updated code.
  • v0.1.9: Updated iOS implementation with improved compatibility and effect loading.
  • v0.1.8: Improved iOS camera initialization and error handling.

Installation #

Before you begin #

Visit the DeepAR developer site to create a project and obtain license keys for Android and iOS.


Android #

  1. Set compileSdkVersion to 33 or higher and minSdkVersion to 23 or higher.

  2. Download native Android dependencies from downloads and place deepar.aar into android/app/libs/.

  3. Run:

    flutter clean
    flutter pub upgrade
    
  4. Add these permissions to your AndroidManifest.xml:

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    
  5. Add these rules to proguard-rules.pro to prevent release crashes:

    -keepclassmembers class ai.deepar.ar.DeepAR { *; }
    -keepclassmembers class ai.deepar.ar.core.videotexture.VideoTextureAndroidJava { *; }
    -keep class ai.deepar.ar.core.videotexture.VideoTextureAndroidJava
    

iOS #

  1. Set deployment target to iOS 13.0 or later.

  2. Run:

    flutter clean
    flutter pub upgrade
    cd ios
    pod install
    
  3. Add these keys to your Info.plist to request camera and microphone permissions:

    <key>NSCameraUsageDescription</key>
    <string>Camera access is required for AR effects</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Microphone access is required for recording videos</string>
    
  4. Add this snippet to your ios/Podfile for permission handler support:

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
            '$(inherited)',
            'PERMISSION_CAMERA=1',
            'PERMISSION_MICROPHONE=1',
          ]
        end
      end
    end
    

Flutter Usage #

  1. Initialize DeepArControllerPerfect by passing your license keys:
final DeepArControllerPerfect _controller = DeepArControllerPerfect();
final result = await _controller.initialize(
  androidLicenseKey: "---android key---",
  iosLicenseKey: "---iOS key---",
  resolution: Resolution.medium,
);

if (result.success) {
  print("Initialization successful: ${result.message}");

  if (Platform.isIOS) {
    Timer.periodic(Duration(milliseconds: 500), (timer) {
      if (_controller.isInitialized) {
        print('iOS view fully initialized');
        setState(() {});
        timer.cancel();
      } else if (timer.tick > 20) {
        print('Timeout waiting for iOS view initialization');
        timer.cancel();
      }
    });
  }
} else {
  print("Initialization failed: ${result.message}");
}
  1. Display the preview widget:
@override
Widget build(BuildContext context) {
  return _controller.isInitialized
      ? DeepArPreviewPerfect(_controller)
      : const Center(child: Text("Loading Preview"));
}
  1. Load effects from assets, file paths, or URLs:
await _controller.switchEffect("assets/effects/my_effect.deepar");
await _controller.switchEffect("/path/to/effect/file.deepar");
await _controller.switchEffect("https://example.com/effects/my_effect.deepar");
  1. Take screenshots:
final File file = await _controller.takeScreenshot();
  1. Record videos:
if (_controller.isRecording) {
  _controller.stopVideoRecording();
} else {
  final File videoFile = _controller.startVideoRecording();
}

For more details, visit DeepAR Developer Help.


6
likes
130
points
48
downloads

Publisher

verified publisherassajeeb.com

Weekly Downloads

DeepAR Flutter plugin with full support for all Android devices—including Xiaomi—and iOS. Easily load AR effects from assets, file paths, or URLs for smooth, reliable performance everywhere.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, flutter_cache_manager, permission_handler, vector_math

More

Packages that depend on deepar_flutter_perfect

Packages that implement deepar_flutter_perfect