분류, 패키지 및 저장소 검색

arkit_plugin 표지
패키지 상세v1.5.0

arkit_plugin

ARKit용 플러터 플러그인 - 애플의 iOS 모바일 장치를 위한 증강현실(AR) 개발 플랫폼입니다.

iOS
30일 다운로드
3.1천
좋아요
510
Pub 점수
160

패키지 설치

flutter pub add arkit_plugin

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

arkit_plugin은 Flutter 패키지로, 개발자가 iOS 애플리케이션에 Apple의 ARKit를 통합할 수 있도록 해주며 증강현실 경험을 가능하게 합니다. 이 플러그인은 평면 감지, 객체 추적, 3D 렌더링과 같은 ARKit의 핵심 기능에 Flutter 친화적인 인터페이스를 통해 접근할 수 있게 해줍니다. iOS 전용으로 설계되어 네이티브 성능과 기능을 활용해 Flutter 앱 내부에 AR 콘텐츠를 원활하게 삽입할 수 있습니다. 개발자는 Dart를 사용하여 AR 세션을 제어하고 현실 세계 환경과 상호작용하며 최소한의 보일러플레이트로 몰입형 AR 애플리케이션을 구축할 수 있습니다.

사용 사례

  • AR 제품 시각화 도구 구축
  • 인터랙티브 AR 게임 만들기
  • 가상 가구 배치 활성화
  • 교육용 AR 경험 개발

주요 기능

  • 네이티브 ARKit 통합
  • 평면 및 이미지 감지
  • 3D 모델 렌더링
  • 실시간 카메라 및 모션 트래킹
  • Flutter 호환 API

적합한 대상

  • iOS AR 앱 개발자
  • 제품 시각화 앱
  • 교육용 AR 도구
  • 인터랙티브 게임 애플리케이션

고려 사항

  • iOS 전용 플랫폼 지원
  • ARKit 호환 장치 필요
  • 애플 생태계에 제한됨
  • AR 세션 라이프사이클을 신중하게 다뤄야 합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

logo

Codemagic build status flutter awesome pub package

Note: ARKit is only supported by mobile devices with A9 or later processors (iPhone 6s/7/SE/8/X, iPad 2017/Pro) on iOS 11 and newer. For some features iOS 12 or newer is required. Flutter >=3.19.0 supports iOS 12.0 and newer, if iOS 11 support is needed use the plugin version before 1.1.0.

Usage

Add dependency

Follow the installation instructions from Dart Packages site.

Update Info.plist

ARKit uses the device camera, so do not forget to provide the NSCameraUsageDescription. You may specify it in Info.plist like that:

    <key>NSCameraUsageDescription</key>
    <string>Describe why your app needs AR here.</string>
Update Podfile

At the top level of the ios folder uncomment the second line in the Podfile and change the iOS minimum version from 9.0 to the appropriate one. The minimum supported iOS version is 13.0.

From:

# platform :ios, '9.0'

To:

platform :ios, '13.0'

NOTE: If when running for the first time you get a cocoapods error, delete the Podfile.lock file in the ios folder. Open the ios folder in the terminal and run:

pod install
Write the app

The simplest code example:

import 'package:flutter/material.dart';
import 'package:arkit_plugin/arkit_plugin.dart';
import 'package:vector_math/vector_math_64.dart';

void main() => runApp(MaterialApp(home: MyApp()));

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late ARKitController arkitController;

  @override
  void dispose() {
    arkitController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) => Scaffold(
      appBar: AppBar(title: const Text('ARKit in Flutter')),
      body: ARKitSceneView(onARKitViewCreated: onARKitViewCreated));

  void onARKitViewCreated(ARKitController arkitController) {
    this.arkitController = arkitController;
    final node = ARKitNode(
        geometry: ARKitSphere(radius: 0.1), position: Vector3(0, 0, -0.5));
    this.arkitController.add(node);
  }
}

Result:

flutter

Examples

I would highly recommend to review the sample from the Example folder inside the plugin. Some samples rely on this Earth image

Name Description Link Demo
Hello World The simplest scene with different geometries. code twitter
Check configuration Shows which kinds of AR configuration are supported on the device code
Earth Sphere with an image texture and rotation animation. code twitter
Tap Sphere which handles tap event. code twitter
Midas Turns walls, floor, and Earth itself into gold by tap. code twitter
Plane Detection Detects horizontal plane. code twitter
Distance tracking Detects horizontal plane and track distance on it. code twitter
Measure Measures distances code twitter
Physics A sphere and a plane with dynamic and static physics code twitter
Image Detection Detects Earth photo and puts a 3D object near it. code twitter
Network Image Detection Detects Mars photo and puts a 3D object near it. code
Custom Light Hello World scene with a custom light spot. code
Light Estimation Estimates and applies the light around you. code twitter
Custom Object Place custom object on plane with coaching overlay. code twitter
Load .gltf .glb Load .gltf or .glb from the Flutter assets or the Documents folder. code
Occlusion Spheres which are not visible after horizontal and vertical planes. code twitter
Manipulation Custom objects with pinch and rotation events. code twitter
Face Tracking Face mask sample. code twitter
Body Tracking Dash that follows your hand. code twitter
Panorama 360 photo. code twitter
Video 360 video. code twitter
Custom Animation Custom object animation. Port of https://github.com/eh3rrera/ARKitAnimation code twitter
Widget Projection Flutter widgets in AR code twitter
Real Time Updates Calls a function once per frame code
Snapshot Make a photo of AR content code
Depth Scene Snapshot Make a photo of the depth scene using LiDAR code

If you prefer video here is a playlist with "AR in Flutter" videos:

AR in Flutter videos

UX advice

You might want to check the device capabilities before establishing an AR session. Review the Check Support sample for the implementation details.

If your app requires placing objects consider using coaching overlays. Review the Custom Object sample for the implementation details.

TrueDepth / Face Tracking

TrueDepth/face-tracking code is not compiled in by default, so most apps are App Store-safe without any extra configuration.

If your app uses face tracking, opt in by enabling the ENABLE_TRUEDEPTH_API Swift flag. Flutter 3.44+ builds plugins with Swift Package Manager, so follow the SPM steps below. The CocoaPods section applies only to older Flutter versions that still build with CocoaPods — if you've configured SPM, you don't need it.

SPM (Flutter 3.44+) — Add a key to ios/Runner/Info.plist:

<key>ARKitFaceTrackingEnabled</key><true/>

Then clear the SwiftPM manifest cache and DerivedData so Xcode re-evaluates the package manifest with the new value:

rm -rf ~/Library/Caches/org.swift.swiftpm/manifests
rm -rf ~/Library/Developer/Xcode/DerivedData

Important: clearing the manifest cache is required. SwiftPM caches the evaluated Package.swift keyed on the manifest's own contents, so a change to Info.plist alone does not invalidate it — flutter clean and Xcode's Clean Build Folder are not enough on their own.

For monorepos or other layouts where ios/Runner/Info.plist is not found automatically, use an environment variable instead:

# When building from terminal (flutter run / flutter build)
export ARKIT_FACE_TRACKING_ENABLED=1

# When building from Xcode GUI
launchctl setenv ARKIT_FACE_TRACKING_ENABLED 1

Then clear the SwiftPM manifest cache and DerivedData as above.

CocoaPods (older Flutter versions only) — if your project still builds with CocoaPods instead of SPM, add to ios/Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    if target.name == 'arkit_plugin'
      target.build_configurations.each do |config|
        config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -DENABLE_TRUEDEPTH_API'
      end
    end
  end
end

FAQ

  • Is it possible to use this plugin on Android?
    No, as ARKit is not available on Android. You might want to try ARCore plugin instead.
  • My app crashes when I open the AR scene several times. Why?
    Most probably that's because you didn't call dispose method on the ARKit controller.
  • One of the features I need is merged in the repository, but is not available on pub.dev. How can I use the latest version?
    You may use the latest version by changing the pubspec.yaml dependency to:
dependencies:
  arkit_plugin:
    git: git://github.com/olexale/arkit_flutter_plugin.git

Contributing

If you find a bug or would like to request a new feature, just open an issue. Your contributions are always welcome!

카테고리

의존성

의존성 목록 3 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.