Repository: rushio-consulting/flutter_camera_ml_vision
Branch: master
Commit: 502409a4d62c
Files: 49
Total size: 89.4 KB
Directory structure:
gitextract_meceayu3/
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── example/
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android/
│ │ ├── app/
│ │ │ ├── build.gradle
│ │ │ └── src/
│ │ │ ├── debug/
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── fr/
│ │ │ │ │ └── rushioconsulting/
│ │ │ │ │ └── flutter_camera_ml_vision_example/
│ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ └── launch_background.xml
│ │ │ │ └── values/
│ │ │ │ └── styles.xml
│ │ │ └── profile/
│ │ │ └── AndroidManifest.xml
│ │ ├── build.gradle
│ │ ├── gradle/
│ │ │ └── wrapper/
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradle.properties
│ │ └── settings.gradle
│ ├── ios/
│ │ ├── Flutter/
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Podfile
│ │ ├── Runner/
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchImage.imageset/
│ │ │ │ ├── Contents.json
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ │ ├── Runner.xcodeproj/
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace/
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata/
│ │ │ └── xcschemes/
│ │ │ └── Runner.xcscheme
│ │ └── Runner.xcworkspace/
│ │ └── contents.xcworkspacedata
│ ├── lib/
│ │ ├── main.dart
│ │ ├── main_face.dart
│ │ └── main_live.dart
│ ├── pubspec.yaml
│ └── test/
│ └── widget_test.dart
├── flutter_camera_ml_vision.iml
├── lib/
│ ├── flutter_camera_ml_vision.dart
│ └── utils.dart
├── pubspec.yaml
└── test/
└── flutter_camera_ml_vision_test.dart
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: [Kleak,jaumard]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['kleak*keybase.io']
================================================
FILE: .github/workflows/main.yml
================================================
name: CI
on:
pull_request:
branches:
- master
jobs:
analyze:
runs-on: ubuntu-latest
container:
image: cirrusci/flutter:stable
steps:
- uses: actions/checkout@v1
- run: sudo chown -R cirrus:cirrus ./ /github/home/
- name: Flutter pub get
run: flutter packages get
- name: Flutter analyze --suppress-analytics
run: flutter analyze --suppress-analytics
================================================
FILE: .gitignore
================================================
.DS_Store
.dart_tool/
.packages
.pub/
.vscode/
idea/
build/
ios/.generated/
ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*
google-services.json
.idea/
/example/ios/GoogleService-Info.plist
/example/ios/Runner/GoogleService-Info.plist
example/ios/Flutter/flutter_export_environment.sh
================================================
FILE: .metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
channel: stable
project_type: package
================================================
FILE: CHANGELOG.md
================================================
## [3.0.1] - 30/04/2021
- update deps
- fix camera distortion
## [3.0.0] - 17/04/2021
- migrate to null safety
## [2.3.0] - 03/10/2020
- fix NPE on aspect ratio
- update deps
## [2.2.5] - 12/02/2020
- fix crash on android app lifecycle
- expose camera controller
- pass default resolution to high to improve reading of barcode
- update deps
## [2.2.4] - 04/11/2019
- simplify pause stream when not on screen by using VisibilityDetector widget
## [2.2.3] - 23/10/2019
- fix crash when setState is called when unmounted
- update dependencies
## [2.2.2] - 02/09/2019
- fix black screen on some Android device in profile/release mode
## [2.2.1] - 19/06/2019
- fix bug when specifying resolution
## [2.2.0] - 16/06/2019
- disable audio (#43)
- let user define camera resolution (#45)
## [2.1.0] - 16/05/2019
expose more function from camera controller
- prepareForVideoRecording
- startVideoRecording
- stopVideoRecording
- takePicture
## [2.0.1] - 5/05/2019
* fix a crash when poping a route with the camera preview
## [2.0.0] - 2/05/2019
* We now forward the result from firebase_ml_vision for onResult
## [1.5.0] - 24/04/2019
* fix installation problems
* Expose camera value
## [1.4.0] - 24/04/2019
* add cameraLensDirection parameter (this default to back)
## [1.3.0] - 17/04/2019
* add overlayBuilder parameter
## [1.2.0] - 12/04/2019
* fix crash above android api 21.
* fix pause when a new route is pushed.
## [1.1.0] - 11/04/2019
* Allow usage under android api 21.
* Add error type on error builder.
## [1.0.0] - 10/04/2019
* Initial release.
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2019 Rushio Consulting
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Flutter Camera Ml Vision
[](https://pub.dartlang.org/packages/flutter_camera_ml_vision)
A Flutter package for iOS and Android to show a preview of the camera and detect things with Firebase ML Vision.
<img src="https://raw.githubusercontent.com/rushio-consulting/flutter_camera_ml_vision/master/videos/scan_page.gif" width="100" />
## Installation
First, add `flutter_camera_ml_vision` as a dependency.
```yaml
...
dependencies:
flutter:
sdk: flutter
flutter_camera_ml_vision: ^2.2.4
...
```
## Configure Firebase
You must also configure Firebase for each platform project: Android and iOS (see the `example` folder or https://firebase.google.com/codelabs/firebase-get-to-know-flutter#3 for step by step details).
### iOS
Add two rows to the ios/Runner/Info.plist:
* one with the key Privacy - Camera Usage Description and a usage description.
* and one with the key Privacy - Microphone Usage Description and a usage description.
Or in text format add the key:
```
<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can I use the mic please?</string>
```
If you're using one of the on-device APIs, include the corresponding ML Kit library model in your Podfile. Then run pod update in a terminal within the same directory as your Podfile.
```
pod 'Firebase/MLVisionBarcodeModel'
pod 'Firebase/MLVisionFaceModel'
pod 'Firebase/MLVisionLabelModel'
pod 'Firebase/MLVisionTextModel'
```
### Android
Change the minimum Android sdk version to 21 (or higher) in your `android/app/build.gradle` file.
```
minSdkVersion 21
```
_ps: This is due to the dependency on the camera plugin._
If you're using the on-device `LabelDetector`, include the latest matching [ML Kit: Image Labeling](https://firebase.google.com/support/release-notes/android) dependency in your app-level `build.gradle` file.
```gradle
android {
dependencies {
// ...
api 'com.google.firebase:firebase-ml-vision-image-label-model:19.0.0'
}
}
```
If you receive compilation errors, try an earlier version of [ML Kit: Image Labeling](https://firebase.google.com/support/release-notes/android).
Optional but recommended: If you use the on-device API, configure your app to automatically download the ML model to the device after your app is installed from the Play Store. To do so, add the following declaration to your app's `AndroidManifest.xml` file:
```xml
<application ...>
...
<meta-data
android:name="com.google.firebase.ml.vision.DEPENDENCIES"
android:value="ocr" />
<!-- To use multiple models: android:value="ocr,label,barcode,face" -->
</application>
```
## Usage
### 1. Example with Barcode
```dart
CameraMlVision<List<Barcode>>(
detector: FirebaseVision.instance.barcodeDetector().detectInImage,
onResult: (List<Barcode> barcodes) {
if (!mounted || resultSent) {
return;
}
resultSent = true;
Navigator.of(context).pop<Barcode>(barcodes.first);
},
)
```
`CameraMlVision` is a widget that shows the preview of the camera. It takes a detector as a parameter here we pass the `detectInImage` method of the `BarcodeDetector` object.
The detector parameter can take all the different FirebaseVision Detector. Here is a list :
```
FirebaseVision.instance.barcodeDetector().detectInImage
FirebaseVision.instance.cloudLabelDetector().detectInImage
FirebaseVision.instance.faceDetector().processImage
FirebaseVision.instance.labelDetector().detectInImage
FirebaseVision.instance.textRecognizer().processImage
```
Then when something is detected the onResult callback is called with the data in the parameter of the function.
### Exposed functionality from CameraController
We expose some functionality from the CameraController class here a list of these :
- value
- prepareForVideoRecording
- startVideoRecording
- stopVideoRecording
- takePicture
## Getting Started
See the `example` directory for a complete sample app.
## Features and bugs
Please file feature requests and bugs at the [issue tracker](https://github.com/santetis/flutter_camera_ml_vision/issues).
## Technical Support
For any technical support, don't hesitate to contact us.
Find more information in our [website](https://rushio-consulting.fr)
For now, all the issues with the label `support` mean that they come out of the scope of the following project. So you can [contact us](https://rushio-consulting.fr/support) as a support.
================================================
FILE: analysis_options.yaml
================================================
include: package:pedantic/analysis_options.yaml
================================================
FILE: example/.gitignore
================================================
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# Visual Studio Code related
.vscode/
# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
/build/
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/ios/GoogleService-Info.plist
/.flutter-plugins-dependencies
================================================
FILE: example/.metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
channel: stable
project_type: app
================================================
FILE: example/README.md
================================================
```dart
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/material.dart';
import 'package:flutter_camera_ml_vision/flutter_camera_ml_vision.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<String> data = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
RaisedButton(
child: Text('Scan product'),
onPressed: () async {
final barcode = await Navigator.of(context).push<Barcode>(
MaterialPageRoute(
builder: (c) {
return ScanPage();
},
),
);
if (barcode == null) {
return;
}
setState(() {
data.add(barcode.displayValue);
});
},
),
Expanded(
child: ListView(
children: data.map((d) => Text(d)).toList(),
),
),
],
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class ScanPage extends StatefulWidget {
@override
_ScanPageState createState() => _ScanPageState();
}
class _ScanPageState extends State<ScanPage> {
bool resultSent = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: CameraMlVision<List<Barcode>>(
detector: FirebaseVision.instance.barcodeDetector().detectInImage,
onResult: (List<Barcode> barcodes) {
if (!mounted || resultSent) {
return;
}
resultSent = true;
Navigator.of(context).pop<Barcode>(barcodes.first);
},
),
),
),
);
}
}
```
================================================
FILE: example/android/app/build.gradle
================================================
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "fr.rushioconsulting.flutter_camera_ml_vision_example"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
api 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
================================================
FILE: example/android/app/src/debug/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.rushioconsulting.flutter_camera_ml_vision_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
================================================
FILE: example/android/app/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.rushioconsulting.flutter_camera_ml_vision_example"
xmlns:tools="http://schemas.android.com/tools">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter_camera_ml_vision_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.firebase.ml.vision.DEPENDENCIES"
android:value="barcode" />
</application>
</manifest>
================================================
FILE: example/android/app/src/main/java/fr/rushioconsulting/flutter_camera_ml_vision_example/MainActivity.java
================================================
package fr.rushioconsulting.flutter_camera_ml_vision_example;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
================================================
FILE: example/android/app/src/main/res/drawable/launch_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
================================================
FILE: example/android/app/src/main/res/values/styles.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
================================================
FILE: example/android/app/src/profile/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.rushioconsulting.flutter_camera_ml_vision_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
================================================
FILE: example/android/build.gradle
================================================
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.google.gms:google-services:4.3.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: example/android/gradle/wrapper/gradle-wrapper.properties
================================================
#Thu Apr 15 16:29:32 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
================================================
FILE: example/android/gradle.properties
================================================
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
================================================
FILE: example/android/settings.gradle
================================================
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
================================================
FILE: example/ios/Flutter/AppFrameworkInfo.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
</dict>
</plist>
================================================
FILE: example/ios/Flutter/Debug.xcconfig
================================================
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
================================================
FILE: example/ios/Flutter/Release.xcconfig
================================================
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
================================================
FILE: example/ios/Podfile
================================================
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
# because of issue https://github.com/FirebaseExtended/flutterfire/issues/4625#issuecomment-821792539
# need custom git version until it's done
pod 'FirebaseMLVisionBarcodeModel', '0.21', :source => 'git@github.com:rozdonmobile/CocoaPodsSpecs.git'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
================================================
FILE: example/ios/Runner/AppDelegate.h
================================================
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : FlutterAppDelegate
@end
================================================
FILE: example/ios/Runner/AppDelegate.m
================================================
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
================================================
FILE: example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
================================================
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
================================================
FILE: example/ios/Runner/Base.lproj/LaunchScreen.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
================================================
FILE: example/ios/Runner/Base.lproj/Main.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
================================================
FILE: example/ios/Runner/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>flutter_camera_ml_vision_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FirebaseScreenReportingEnabled</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>What do you think ;) </string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
================================================
FILE: example/ios/Runner/main.m
================================================
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char* argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
================================================
FILE: example/ios/Runner.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
9B3F00512A092EB63507600C /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE99F0092DC98CB10C7128A7 /* libPods-Runner.a */; };
BD05840B228E98DD00D7684A /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BD05840A228E98DD00D7684A /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2409E7A613325A687028AE0F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BD05840A228E98DD00D7684A /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
CE99F0092DC98CB10C7128A7 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F51EA479259F9D93D435315C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
FDC4259C7A63125CD0C3D54C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9B3F00512A092EB63507600C /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5BABECA882D889E73F189ACB /* Pods */ = {
isa = PBXGroup;
children = (
FDC4259C7A63125CD0C3D54C /* Pods-Runner.debug.xcconfig */,
2409E7A613325A687028AE0F /* Pods-Runner.release.xcconfig */,
F51EA479259F9D93D435315C /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
5BABECA882D889E73F189ACB /* Pods */,
F7B13BC660916DD00ED1C090 /* Frameworks */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
BD05840A228E98DD00D7684A /* GoogleService-Info.plist */,
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
);
path = Runner;
sourceTree = "<group>";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
97C146F21CF9000F007C117D /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
F7B13BC660916DD00ED1C090 /* Frameworks */ = {
isa = PBXGroup;
children = (
CE99F0092DC98CB10C7128A7 /* libPods-Runner.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
F343DCC5B5CF7B2EC0AA5D44 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = A9C4HVFYJX;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
BD05840B228E98DD00D7684A /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
F343DCC5B5CF7B2EC0AA5D44 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
97C146F31CF9000F007C117D /* main.m in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = A9C4HVFYJX;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = "fr.rushioconsulting.flutter-camera-ml-vision-example";
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = A9C4HVFYJX;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = "fr.rushioconsulting.flutter-camera-ml-vision-example";
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = A9C4HVFYJX;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = "fr.rushioconsulting.flutter-camera-ml-vision-example";
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
================================================
FILE: example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
================================================
FILE: example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
================================================
FILE: example/ios/Runner.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
================================================
FILE: example/lib/main.dart
================================================
import 'dart:ui';
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/material.dart';
import 'package:flutter_camera_ml_vision/flutter_camera_ml_vision.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<String> data = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () async {
final barcode = await Navigator.of(context).push<Barcode>(
MaterialPageRoute(
builder: (c) {
return ScanPage();
},
),
);
if (barcode == null) {
return;
}
setState(() {
data.add(barcode.displayValue);
});
},
child: Text('Scan product'),
),
Expanded(
child: ListView(
children: data.map((d) => Text(d)).toList(),
),
),
],
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class ScanPage extends StatefulWidget {
@override
_ScanPageState createState() => _ScanPageState();
}
class _ScanPageState extends State<ScanPage> {
bool resultSent = false;
BarcodeDetector detector = FirebaseVision.instance.barcodeDetector();
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: CameraMlVision<List<Barcode>>(
overlayBuilder: (c) {
return Container(
decoration: ShapeDecoration(
shape: _ScannerOverlayShape(
borderColor: Theme.of(context).primaryColor,
borderWidth: 3.0,
),
),
);
},
detector: detector.detectInImage,
onResult: (List<Barcode> barcodes) {
if (!mounted ||
resultSent ||
barcodes == null ||
barcodes.isEmpty) {
return;
}
resultSent = true;
Navigator.of(context).pop<Barcode>(barcodes.first);
},
onDispose: () {
detector.close();
},
),
),
),
);
}
}
class _ScannerOverlayShape extends ShapeBorder {
final Color borderColor;
final double borderWidth;
final Color overlayColor;
_ScannerOverlayShape({
this.borderColor = Colors.white,
this.borderWidth = 1.0,
this.overlayColor = const Color(0x88000000),
});
@override
EdgeInsetsGeometry get dimensions => EdgeInsets.all(10.0);
@override
Path getInnerPath(Rect rect, {TextDirection textDirection}) {
return Path()
..fillType = PathFillType.evenOdd
..addPath(getOuterPath(rect), Offset.zero);
}
@override
Path getOuterPath(Rect rect, {TextDirection textDirection}) {
Path _getLeftTopPath(Rect rect) {
return Path()
..moveTo(rect.left, rect.bottom)
..lineTo(rect.left, rect.top)
..lineTo(rect.right, rect.top);
}
return _getLeftTopPath(rect)
..lineTo(
rect.right,
rect.bottom,
)
..lineTo(
rect.left,
rect.bottom,
)
..lineTo(
rect.left,
rect.top,
);
}
@override
void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) {
const lineSize = 30;
final width = rect.width;
final borderWidthSize = width * 10 / 100;
final height = rect.height;
final borderHeightSize = height - (width - borderWidthSize);
final borderSize = Size(borderWidthSize / 2, borderHeightSize / 2);
var paint = Paint()
..color = overlayColor
..style = PaintingStyle.fill;
canvas
..drawRect(
Rect.fromLTRB(
rect.left, rect.top, rect.right, borderSize.height + rect.top),
paint,
)
..drawRect(
Rect.fromLTRB(rect.left, rect.bottom - borderSize.height, rect.right,
rect.bottom),
paint,
)
..drawRect(
Rect.fromLTRB(rect.left, rect.top + borderSize.height,
rect.left + borderSize.width, rect.bottom - borderSize.height),
paint,
)
..drawRect(
Rect.fromLTRB(
rect.right - borderSize.width,
rect.top + borderSize.height,
rect.right,
rect.bottom - borderSize.height),
paint,
);
paint = Paint()
..color = borderColor
..style = PaintingStyle.stroke
..strokeWidth = borderWidth;
final borderOffset = borderWidth / 2;
final realReact = Rect.fromLTRB(
borderSize.width + borderOffset,
borderSize.height + borderOffset + rect.top,
width - borderSize.width - borderOffset,
height - borderSize.height - borderOffset + rect.top);
//Draw top right corner
canvas
..drawPath(
Path()
..moveTo(realReact.right, realReact.top)
..lineTo(realReact.right, realReact.top + lineSize),
paint)
..drawPath(
Path()
..moveTo(realReact.right, realReact.top)
..lineTo(realReact.right - lineSize, realReact.top),
paint)
..drawPoints(
PointMode.points,
[Offset(realReact.right, realReact.top)],
paint,
)
//Draw top left corner
..drawPath(
Path()
..moveTo(realReact.left, realReact.top)
..lineTo(realReact.left, realReact.top + lineSize),
paint)
..drawPath(
Path()
..moveTo(realReact.left, realReact.top)
..lineTo(realReact.left + lineSize, realReact.top),
paint)
..drawPoints(
PointMode.points,
[Offset(realReact.left, realReact.top)],
paint,
)
//Draw bottom right corner
..drawPath(
Path()
..moveTo(realReact.right, realReact.bottom)
..lineTo(realReact.right, realReact.bottom - lineSize),
paint)
..drawPath(
Path()
..moveTo(realReact.right, realReact.bottom)
..lineTo(realReact.right - lineSize, realReact.bottom),
paint)
..drawPoints(
PointMode.points,
[Offset(realReact.right, realReact.bottom)],
paint,
)
//Draw bottom left corner
..drawPath(
Path()
..moveTo(realReact.left, realReact.bottom)
..lineTo(realReact.left, realReact.bottom - lineSize),
paint)
..drawPath(
Path()
..moveTo(realReact.left, realReact.bottom)
..lineTo(realReact.left + lineSize, realReact.bottom),
paint)
..drawPoints(
PointMode.points,
[Offset(realReact.left, realReact.bottom)],
paint,
);
}
@override
ShapeBorder scale(double t) {
return _ScannerOverlayShape(
borderColor: borderColor,
borderWidth: borderWidth,
overlayColor: overlayColor,
);
}
}
================================================
FILE: example/lib/main_face.dart
================================================
import 'package:camera/camera.dart';
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/material.dart';
import 'package:flutter_camera_ml_vision/flutter_camera_ml_vision.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<Face> _faces = [];
final _scanKey = GlobalKey<CameraMlVisionState>();
CameraLensDirection cameraLensDirection = CameraLensDirection.front;
FaceDetector detector =
FirebaseVision.instance.faceDetector(FaceDetectorOptions(
enableTracking: true,
mode: FaceDetectorMode.accurate,
));
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: SizedBox.expand(
child: CameraMlVision<List<Face>>(
key: _scanKey,
cameraLensDirection: cameraLensDirection,
detector: detector.processImage,
overlayBuilder: (c) {
return CustomPaint(
painter: FaceDetectorPainter(
_scanKey.currentState.cameraValue.previewSize.flipped, _faces,
reflection: cameraLensDirection == CameraLensDirection.front),
);
},
onResult: (faces) {
if (faces == null || faces.isEmpty || !mounted) {
return;
}
setState(() {
_faces = [...faces];
});
},
onDispose: () {
detector.close();
},
),
),
);
}
}
class FaceDetectorPainter extends CustomPainter {
FaceDetectorPainter(this.imageSize, this.faces, {this.reflection = false});
final bool reflection;
final Size imageSize;
final List<Face> faces;
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2.0
..color = Colors.red;
for (final face in faces) {
final faceRect =
_reflectionRect(reflection, face.boundingBox, imageSize.width);
canvas.drawRect(
_scaleRect(
rect: faceRect,
imageSize: imageSize,
widgetSize: size,
),
paint,
);
}
}
@override
bool shouldRepaint(FaceDetectorPainter oldDelegate) {
return oldDelegate.imageSize != imageSize || oldDelegate.faces != faces;
}
}
Rect _reflectionRect(bool reflection, Rect boundingBox, double width) {
if (!reflection) {
return boundingBox;
}
final centerX = width / 2;
final left = ((boundingBox.left - centerX) * -1) + centerX;
final right = ((boundingBox.right - centerX) * -1) + centerX;
return Rect.fromLTRB(left, boundingBox.top, right, boundingBox.bottom);
}
Rect _scaleRect({
@required Rect rect,
@required Size imageSize,
@required Size widgetSize,
}) {
final scaleX = widgetSize.width / imageSize.width;
final scaleY = widgetSize.height / imageSize.height;
final scaledRect = Rect.fromLTRB(
rect.left.toDouble() * scaleX,
rect.top.toDouble() * scaleY,
rect.right.toDouble() * scaleX,
rect.bottom.toDouble() * scaleY,
);
return scaledRect;
}
================================================
FILE: example/lib/main_live.dart
================================================
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/material.dart';
import 'package:flutter_camera_ml_vision/flutter_camera_ml_vision.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<String> data = [];
final _scanKey = GlobalKey<CameraMlVisionState>();
BarcodeDetector detector = FirebaseVision.instance.barcodeDetector();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Stack(
fit: StackFit.expand,
children: [
CameraMlVision<List<Barcode>>(
key: _scanKey,
detector: detector.detectInImage,
resolution: ResolutionPreset.high,
onResult: (barcodes) {
if (barcodes == null ||
barcodes.isEmpty ||
data.contains(barcodes.first.displayValue) ||
!mounted) {
return;
}
setState(() {
data.add(barcodes.first.displayValue);
});
},
onDispose: () {
detector.close();
},
),
Container(
alignment: Alignment.bottomCenter,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 250),
child: Scrollbar(
child: ListView(
children: data.map((d) {
return Container(
color: Color(0xAAFFFFFF),
child: Padding(
padding: const EdgeInsets.all(16),
child: Text(d),
),
);
}).toList(),
),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ElevatedButton(
onPressed: () {
_scanKey.currentState.toggle();
},
child: Text('Start/Pause camera'),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => _SecondScreen()));
},
child: Text('Push new route'),
),
],
),
],
),
),
],
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class _SecondScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => _SecondScreen(),
));
},
child: Text('Push new route'),
),
);
}
}
================================================
FILE: example/pubspec.yaml
================================================
name: example
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.2.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
flutter_camera_ml_vision:
path: ../
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
================================================
FILE: example/test/widget_test.dart
================================================
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
// import 'package:flutter/material.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:example/main.dart';
// void main() {
// testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// // Build our app and trigger a frame.
// await tester.pumpWidget(MyApp());
// // Verify that our counter starts at 0.
// expect(find.text('0'), findsOneWidget);
// expect(find.text('1'), findsNothing);
// // Tap the '+' icon and trigger a frame.
// await tester.tap(find.byIcon(Icons.add));
// await tester.pump();
// // Verify that our counter has incremented.
// expect(find.text('0'), findsNothing);
// expect(find.text('1'), findsOneWidget);
// });
// }
================================================
FILE: flutter_camera_ml_vision.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>
</module>
================================================
FILE: lib/flutter_camera_ml_vision.dart
================================================
library flutter_camera_ml_vision;
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui';
import 'package:camera/camera.dart';
import 'package:collection/collection.dart';
import 'package:device_info/device_info.dart';
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:visibility_detector/visibility_detector.dart';
export 'package:camera/camera.dart';
part 'utils.dart';
typedef HandleDetection<T> = Future<T> Function(FirebaseVisionImage image);
typedef ErrorWidgetBuilder = Widget Function(
BuildContext context, CameraError error);
enum CameraError {
unknown,
cantInitializeCamera,
androidVersionNotSupported,
noCameraAvailable,
}
enum _CameraState {
loading,
error,
ready,
}
class CameraMlVision<T> extends StatefulWidget {
final HandleDetection<T> detector;
final Function(T) onResult;
final WidgetBuilder? loadingBuilder;
final ErrorWidgetBuilder? errorBuilder;
final WidgetBuilder? overlayBuilder;
final CameraLensDirection cameraLensDirection;
final ResolutionPreset? resolution;
final Function? onDispose;
CameraMlVision({
Key? key,
required this.onResult,
required this.detector,
this.loadingBuilder,
this.errorBuilder,
this.overlayBuilder,
this.cameraLensDirection = CameraLensDirection.back,
this.resolution,
this.onDispose,
}) : super(key: key);
@override
CameraMlVisionState createState() => CameraMlVisionState<T>();
}
class CameraMlVisionState<T> extends State<CameraMlVision<T>>
with WidgetsBindingObserver {
XFile? _lastImage;
final _visibilityKey = UniqueKey();
CameraController? _cameraController;
ImageRotation? _rotation;
_CameraState _cameraMlVisionState = _CameraState.loading;
CameraError _cameraError = CameraError.unknown;
bool _alreadyCheckingImage = false;
bool _isStreaming = false;
bool _isDeactivate = false;
@override
void initState() {
super.initState();
WidgetsBinding.instance!.addObserver(this);
_initialize();
}
@override
void didUpdateWidget(CameraMlVision<T> oldWidget) {
if (oldWidget.resolution != widget.resolution) {
_initialize();
}
super.didUpdateWidget(oldWidget);
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// App state changed before we got the chance to initialize.
if (_cameraController == null || !_cameraController!.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
_stop(true).then((value) => _cameraController?.dispose());
} else if (state == AppLifecycleState.resumed && _isStreaming) {
_initialize();
}
}
Future<void> stop() async {
if (_cameraController != null) {
await _stop(true);
try {
final image = await _cameraController!.takePicture();
setState(() {
_lastImage = image;
});
} on PlatformException catch (e) {
debugPrint('$e');
}
}
}
Future<void> _stop(bool silently) {
final completer = Completer();
scheduleMicrotask(() async {
if (_cameraController?.value.isStreamingImages == true && mounted) {
await _cameraController!.stopImageStream().catchError((_) {});
}
if (silently) {
_isStreaming = false;
} else {
setState(() {
_isStreaming = false;
});
}
completer.complete();
});
return completer.future;
}
void start() {
if (_cameraController != null) {
_start();
}
}
void _start() {
_cameraController!.startImageStream(_processImage);
setState(() {
_isStreaming = true;
});
}
CameraValue? get cameraValue => _cameraController?.value;
ImageRotation? get imageRotation => _rotation;
Future<void> Function() get prepareForVideoRecording =>
_cameraController!.prepareForVideoRecording;
Future<void> startVideoRecording() async {
await _cameraController!.stopImageStream();
return _cameraController!.startVideoRecording();
}
Future<XFile> stopVideoRecording(String path) async {
final file = await _cameraController!.stopVideoRecording();
await _cameraController!.startImageStream(_processImage);
return file;
}
CameraController? get cameraController => _cameraController;
Future<XFile> takePicture(String path) async {
await _stop(true);
final image = await _cameraController!.takePicture();
_start();
return image;
}
Future<void> flash(FlashMode mode) async {
await _cameraController!.setFlashMode(mode);
}
Future<void> focus(FocusMode mode) async {
await _cameraController!.setFocusMode(mode);
}
Future<void> focusPoint(Offset point) async {
await _cameraController!.setFocusPoint(point);
}
Future<void> zoom(double zoom) async {
await _cameraController!.setZoomLevel(zoom);
}
Future<void> exposure(ExposureMode mode) async {
await _cameraController!.setExposureMode(mode);
}
Future<void> exposureOffset(double offset) async {
await _cameraController!.setExposureOffset(offset);
}
Future<void> exposurePoint(Offset offset) async {
await _cameraController!.setExposurePoint(offset);
}
Future<void> _initialize() async {
if (Platform.isAndroid) {
final deviceInfo = DeviceInfoPlugin();
final androidInfo = await deviceInfo.androidInfo;
if (androidInfo.version.sdkInt < 21) {
debugPrint('Camera plugin doesn\'t support android under version 21');
if (mounted) {
setState(() {
_cameraMlVisionState = _CameraState.error;
_cameraError = CameraError.androidVersionNotSupported;
});
}
return;
}
}
final description = await _getCamera(widget.cameraLensDirection);
if (description == null) {
_cameraMlVisionState = _CameraState.error;
_cameraError = CameraError.noCameraAvailable;
return;
}
if (_cameraController != null) {
await _stop(true);
await _cameraController?.dispose();
}
_cameraController = CameraController(
description,
widget.resolution ?? ResolutionPreset.high,
enableAudio: false,
);
if (!mounted) {
return;
}
try {
await _cameraController!.initialize();
} catch (ex, stack) {
debugPrint('Can\'t initialize camera');
debugPrint('$ex, $stack');
if (mounted) {
setState(() {
_cameraMlVisionState = _CameraState.error;
_cameraError = CameraError.cantInitializeCamera;
});
}
return;
}
if (!mounted) {
return;
}
setState(() {
_cameraMlVisionState = _CameraState.ready;
});
_rotation = _rotationIntToImageRotation(
description.sensorOrientation,
);
//FIXME hacky technique to avoid having black screen on some android devices
await Future.delayed(Duration(milliseconds: 200));
start();
}
@override
void dispose() {
if (widget.onDispose != null) {
widget.onDispose!();
}
if (_cameraController != null) {
_stop(true).then((value) {
_cameraController?.dispose();
});
}
super.dispose();
}
@override
Widget build(BuildContext context) {
if (_cameraMlVisionState == _CameraState.loading) {
return widget.loadingBuilder == null
? Center(child: CircularProgressIndicator())
: widget.loadingBuilder!(context);
}
if (_cameraMlVisionState == _CameraState.error) {
return widget.errorBuilder == null
? Center(child: Text('$_cameraMlVisionState $_cameraError'))
: widget.errorBuilder!(context, _cameraError);
}
var cameraPreview = _isStreaming
? CameraPreview(
_cameraController!,
)
: _getPicture();
if (widget.overlayBuilder != null) {
cameraPreview = Stack(
fit: StackFit.passthrough,
children: [
cameraPreview,
(cameraController?.value.isInitialized ?? false)
? AspectRatio(
aspectRatio: _isLandscape()
? cameraController!.value.aspectRatio
: (1 / cameraController!.value.aspectRatio),
child: widget.overlayBuilder!(context),
)
: Container(),
],
);
}
return VisibilityDetector(
onVisibilityChanged: (VisibilityInfo info) {
if (info.visibleFraction == 0) {
//invisible stop the streaming
_isDeactivate = true;
_stop(true);
} else if (_isDeactivate) {
//visible restart streaming if needed
_isDeactivate = false;
_start();
}
},
key: _visibilityKey,
child: cameraPreview,
);
}
DeviceOrientation? _getApplicableOrientation() {
return (cameraController?.value.isRecordingVideo ?? false)
? cameraController?.value.recordingOrientation
: (cameraController?.value.lockedCaptureOrientation ??
cameraController?.value.deviceOrientation);
}
bool _isLandscape() {
return [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]
.contains(_getApplicableOrientation());
}
void _processImage(CameraImage cameraImage) async {
if (!_alreadyCheckingImage && mounted) {
_alreadyCheckingImage = true;
try {
final results =
await _detect<T>(cameraImage, widget.detector, _rotation!);
widget.onResult(results);
} catch (ex, stack) {
debugPrint('$ex, $stack');
}
_alreadyCheckingImage = false;
}
}
void toggle() {
if (_isStreaming && _cameraController!.value.isStreamingImages) {
stop();
} else {
start();
}
}
Widget _getPicture() {
if (_lastImage != null) {
return Image.file(File(_lastImage!.path));
}
return Container();
}
}
================================================
FILE: lib/utils.dart
================================================
part of 'flutter_camera_ml_vision.dart';
Future<CameraDescription?> _getCamera(CameraLensDirection dir) async {
final cameras = await availableCameras();
final camera = cameras.firstWhereOrNull((camera) => camera.lensDirection == dir);
return camera ?? (cameras.isEmpty ? null : cameras.first);
}
Uint8List _concatenatePlanes(List<Plane> planes) {
final allBytes = WriteBuffer();
planes.forEach((plane) => allBytes.putUint8List(plane.bytes));
return allBytes.done().buffer.asUint8List();
}
FirebaseVisionImageMetadata buildMetaData(
CameraImage image,
ImageRotation rotation,
) {
return FirebaseVisionImageMetadata(
rawFormat: image.format.raw,
size: Size(image.width.toDouble(), image.height.toDouble()),
rotation: rotation,
planeData: image.planes
.map(
(plane) => FirebaseVisionImagePlaneMetadata(
bytesPerRow: plane.bytesPerRow,
height: plane.height,
width: plane.width,
),
)
.toList(),
);
}
Future<T> _detect<T>(
CameraImage image,
HandleDetection<T> handleDetection,
ImageRotation rotation,
) async {
return handleDetection(
FirebaseVisionImage.fromBytes(
_concatenatePlanes(image.planes),
buildMetaData(image, rotation),
),
);
}
ImageRotation _rotationIntToImageRotation(int rotation) {
switch (rotation) {
case 0:
return ImageRotation.rotation0;
case 90:
return ImageRotation.rotation90;
case 180:
return ImageRotation.rotation180;
default:
assert(rotation == 270);
return ImageRotation.rotation270;
}
}
================================================
FILE: pubspec.yaml
================================================
name: flutter_camera_ml_vision
description: A flutter widget that show the camera stream and allow ML vision recognition on it, it allow you to detect barcodes, labels, text, faces...
version: 3.0.1
repository: https://github.com/rushio-consulting/flutter_camera_ml_vision
homepage: https://github.com/rushio-consulting/flutter_camera_ml_vision
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
firebase_ml_vision: ^0.12.0+1
#git:
# url: git://github.com/algirdasmac/flutterfire
# path: packages/firebase_ml_vision
firebase_core: ^1.1.0
visibility_detector: ^0.2.0
path_provider: ^2.0.1
pedantic: ^1.11.0
device_info: ^2.0.0
camera: ^0.8.1
collection: ^1.15.0
dev_dependencies:
flutter_test:
sdk: flutter
================================================
FILE: test/flutter_camera_ml_vision_test.dart
================================================
// import 'package:flutter_test/flutter_test.dart';
// import 'package:flutter_camera_ml_vision/flutter_camera_ml_vision.dart';
void main() {}
gitextract_meceayu3/
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── example/
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android/
│ │ ├── app/
│ │ │ ├── build.gradle
│ │ │ └── src/
│ │ │ ├── debug/
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── fr/
│ │ │ │ │ └── rushioconsulting/
│ │ │ │ │ └── flutter_camera_ml_vision_example/
│ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ └── launch_background.xml
│ │ │ │ └── values/
│ │ │ │ └── styles.xml
│ │ │ └── profile/
│ │ │ └── AndroidManifest.xml
│ │ ├── build.gradle
│ │ ├── gradle/
│ │ │ └── wrapper/
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradle.properties
│ │ └── settings.gradle
│ ├── ios/
│ │ ├── Flutter/
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Podfile
│ │ ├── Runner/
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchImage.imageset/
│ │ │ │ ├── Contents.json
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ │ ├── Runner.xcodeproj/
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace/
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata/
│ │ │ └── xcschemes/
│ │ │ └── Runner.xcscheme
│ │ └── Runner.xcworkspace/
│ │ └── contents.xcworkspacedata
│ ├── lib/
│ │ ├── main.dart
│ │ ├── main_face.dart
│ │ └── main_live.dart
│ ├── pubspec.yaml
│ └── test/
│ └── widget_test.dart
├── flutter_camera_ml_vision.iml
├── lib/
│ ├── flutter_camera_ml_vision.dart
│ └── utils.dart
├── pubspec.yaml
└── test/
└── flutter_camera_ml_vision_test.dart
SYMBOL INDEX (78 symbols across 7 files)
FILE: example/android/app/src/main/java/fr/rushioconsulting/flutter_camera_ml_vision_example/MainActivity.java
class MainActivity (line 7) | public class MainActivity extends FlutterActivity {
method onCreate (line 8) | @Override
FILE: example/lib/main.dart
function main (line 7) | void main()
class MyApp (line 9) | class MyApp extends StatelessWidget {
method build (line 11) | Widget build(BuildContext context)
class MyHomePage (line 22) | class MyHomePage extends StatefulWidget {
method createState (line 28) | _MyHomePageState createState()
class _MyHomePageState (line 31) | class _MyHomePageState extends State<MyHomePage> {
method build (line 35) | Widget build(BuildContext context)
class ScanPage (line 74) | class ScanPage extends StatefulWidget {
method createState (line 76) | _ScanPageState createState()
class _ScanPageState (line 79) | class _ScanPageState extends State<ScanPage> {
method build (line 84) | Widget build(BuildContext context)
class _ScannerOverlayShape (line 121) | class _ScannerOverlayShape extends ShapeBorder {
method getInnerPath (line 136) | Path getInnerPath(Rect rect, {TextDirection textDirection})
method getOuterPath (line 143) | Path getOuterPath(Rect rect, {TextDirection textDirection})
method _getLeftTopPath (line 144) | Path _getLeftTopPath(Rect rect)
method paint (line 167) | void paint(Canvas canvas, Rect rect, {TextDirection textDirection})
method scale (line 288) | ShapeBorder scale(double t)
FILE: example/lib/main_face.dart
function main (line 6) | void main()
class MyApp (line 8) | class MyApp extends StatelessWidget {
method build (line 10) | Widget build(BuildContext context)
class MyHomePage (line 21) | class MyHomePage extends StatefulWidget {
method createState (line 27) | _MyHomePageState createState()
class _MyHomePageState (line 30) | class _MyHomePageState extends State<MyHomePage> {
method build (line 41) | Widget build(BuildContext context)
class FaceDetectorPainter (line 75) | class FaceDetectorPainter extends CustomPainter {
method paint (line 83) | void paint(Canvas canvas, Size size)
method shouldRepaint (line 104) | bool shouldRepaint(FaceDetectorPainter oldDelegate)
function _reflectionRect (line 109) | Rect _reflectionRect(bool reflection, Rect boundingBox, double width)
function _scaleRect (line 119) | Rect _scaleRect({
FILE: example/lib/main_live.dart
function main (line 5) | void main()
class MyApp (line 7) | class MyApp extends StatelessWidget {
method build (line 9) | Widget build(BuildContext context)
class MyHomePage (line 20) | class MyHomePage extends StatefulWidget {
method createState (line 26) | _MyHomePageState createState()
class _MyHomePageState (line 29) | class _MyHomePageState extends State<MyHomePage> {
method build (line 35) | Widget build(BuildContext context)
class _SecondScreen (line 112) | class _SecondScreen extends StatelessWidget {
method build (line 114) | Widget build(BuildContext context)
FILE: lib/flutter_camera_ml_vision.dart
type HandleDetection (line 21) | typedef HandleDetection<T> = Future<T> Function(FirebaseVisionImage image);
type ErrorWidgetBuilder (line 22) | typedef ErrorWidgetBuilder = Widget Function(
type CameraError (line 25) | enum CameraError {
type _CameraState (line 32) | enum _CameraState {
class CameraMlVision (line 38) | class CameraMlVision<T> extends StatefulWidget {
method createState (line 61) | CameraMlVisionState createState()
class CameraMlVisionState (line 64) | class CameraMlVisionState<T> extends State<CameraMlVision<T>>
method initState (line 77) | void initState()
method didUpdateWidget (line 84) | void didUpdateWidget(CameraMlVision<T> oldWidget)
method didChangeAppLifecycleState (line 92) | void didChangeAppLifecycleState(AppLifecycleState state)
method stop (line 104) | Future<void> stop()
method _stop (line 118) | Future<void> _stop(bool silently)
method start (line 137) | void start()
method _start (line 143) | void _start()
method startVideoRecording (line 157) | Future<void> startVideoRecording()
method stopVideoRecording (line 162) | Future<XFile> stopVideoRecording(String path)
method takePicture (line 170) | Future<XFile> takePicture(String path)
method flash (line 177) | Future<void> flash(FlashMode mode)
method focus (line 181) | Future<void> focus(FocusMode mode)
method focusPoint (line 185) | Future<void> focusPoint(Offset point)
method zoom (line 189) | Future<void> zoom(double zoom)
method exposure (line 193) | Future<void> exposure(ExposureMode mode)
method exposureOffset (line 197) | Future<void> exposureOffset(double offset)
method exposurePoint (line 201) | Future<void> exposurePoint(Offset offset)
method _initialize (line 205) | Future<void> _initialize()
method dispose (line 272) | void dispose()
method build (line 286) | Widget build(BuildContext context)
method _getApplicableOrientation (line 337) | DeviceOrientation? _getApplicableOrientation()
method _isLandscape (line 344) | bool _isLandscape()
method _processImage (line 349) | void _processImage(CameraImage cameraImage)
method toggle (line 363) | void toggle()
method _getPicture (line 371) | Widget _getPicture()
FILE: lib/utils.dart
function _getCamera (line 3) | Future<CameraDescription?> _getCamera(CameraLensDirection dir)
function _concatenatePlanes (line 9) | Uint8List _concatenatePlanes(List<Plane> planes)
function buildMetaData (line 15) | FirebaseVisionImageMetadata buildMetaData(
function _detect (line 35) | Future<T> _detect<T>(
function _rotationIntToImageRotation (line 48) | ImageRotation _rotationIntToImageRotation(int rotation)
FILE: test/flutter_camera_ml_vision_test.dart
function main (line 5) | void main()
Condensed preview — 49 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (100K chars).
[
{
"path": ".github/FUNDING.yml",
"chars": 675,
"preview": "# These are supported funding model platforms\n\ngithub: [Kleak,jaumard]# Replace with up to 4 GitHub Sponsors-enabled use"
},
{
"path": ".github/workflows/main.yml",
"chars": 417,
"preview": "name: CI\n\non: \n pull_request:\n branches:\n - master\n \n\njobs:\n analyze:\n runs-on: ubuntu-latest\n containe"
},
{
"path": ".gitignore",
"chars": 311,
"preview": ".DS_Store\n.dart_tool/\n\n.packages\n.pub/\n\n.vscode/\nidea/\n\nbuild/\nios/.generated/\nios/Flutter/Generated.xcconfig\nios/Runner"
},
{
"path": ".metadata",
"chars": 309,
"preview": "# This file tracks properties of this Flutter project.\n# Used by Flutter tool to assess capabilities and perform upgrade"
},
{
"path": "CHANGELOG.md",
"chars": 1583,
"preview": "## [3.0.1] - 30/04/2021\n\n- update deps\n- fix camera distortion\n\n## [3.0.0] - 17/04/2021\n\n- migrate to null safety\n\n## [2"
},
{
"path": "LICENSE",
"chars": 1074,
"preview": "MIT License\n\nCopyright (c) 2019 Rushio Consulting\n\nPermission is hereby granted, free of charge, to any person obtaining"
},
{
"path": "README.md",
"chars": 4534,
"preview": "# Flutter Camera Ml Vision\n\n[](https://pub.dart"
},
{
"path": "analysis_options.yaml",
"chars": 48,
"preview": "include: package:pedantic/analysis_options.yaml\n"
},
{
"path": "example/.gitignore",
"chars": 1349,
"preview": "# Miscellaneous\n*.class\n*.log\n*.pyc\n*.swp\n.DS_Store\n.atom/\n.buildlog/\n.history\n.svn/\n\n# IntelliJ related\n*.iml\n*.ipr\n*.i"
},
{
"path": "example/.metadata",
"chars": 305,
"preview": "# This file tracks properties of this Flutter project.\n# Used by Flutter tool to assess capabilities and perform upgrade"
},
{
"path": "example/README.md",
"chars": 2592,
"preview": "```dart\nimport 'package:firebase_ml_vision/firebase_ml_vision.dart';\nimport 'package:flutter/material.dart';\nimport 'pac"
},
{
"path": "example/android/app/build.gradle",
"chars": 1990,
"preview": "def localProperties = new Properties()\ndef localPropertiesFile = rootProject.file('local.properties')\nif (localPropertie"
},
{
"path": "example/android/app/src/debug/AndroidManifest.xml",
"chars": 360,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"fr.rushioconsulting.flutter_camera_ml_"
},
{
"path": "example/android/app/src/main/AndroidManifest.xml",
"chars": 1939,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"fr.rushioconsulting.flutter_camera_ml_"
},
{
"path": "example/android/app/src/main/java/fr/rushioconsulting/flutter_camera_ml_vision_example/MainActivity.java",
"chars": 397,
"preview": "package fr.rushioconsulting.flutter_camera_ml_vision_example;\n\nimport android.os.Bundle;\nimport io.flutter.app.FlutterAc"
},
{
"path": "example/android/app/src/main/res/drawable/launch_background.xml",
"chars": 434,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Modify this file to customize your launch splash screen -->\n<layer-list xmln"
},
{
"path": "example/android/app/src/main/res/values/styles.xml",
"chars": 361,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <style name=\"LaunchTheme\" parent=\"@android:style/Theme.Black.NoTi"
},
{
"path": "example/android/app/src/profile/AndroidManifest.xml",
"chars": 360,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"fr.rushioconsulting.flutter_camera_ml_"
},
{
"path": "example/android/build.gradle",
"chars": 527,
"preview": "buildscript {\n repositories {\n google()\n jcenter()\n }\n\n dependencies {\n classpath 'com.and"
},
{
"path": "example/android/gradle/wrapper/gradle-wrapper.properties",
"chars": 231,
"preview": "#Thu Apr 15 16:29:32 CEST 2021\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER"
},
{
"path": "example/android/gradle.properties",
"chars": 104,
"preview": "org.gradle.jvmargs=-Xmx1536M\nandroid.enableJetifier=true\nandroid.useAndroidX=true\nandroid.enableR8=true\n"
},
{
"path": "example/android/settings.gradle",
"chars": 484,
"preview": "include ':app'\n\ndef flutterProjectRoot = rootProject.projectDir.parentFile.toPath()\n\ndef plugins = new Properties()\ndef "
},
{
"path": "example/ios/Flutter/AppFrameworkInfo.plist",
"chars": 773,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "example/ios/Flutter/Debug.xcconfig",
"chars": 106,
"preview": "#include \"Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig\"\n#include \"Generated.xcconfig\"\n"
},
{
"path": "example/ios/Flutter/Release.xcconfig",
"chars": 108,
"preview": "#include \"Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig\"\n#include \"Generated.xcconfig\"\n"
},
{
"path": "example/ios/Podfile",
"chars": 1561,
"preview": "# Uncomment this line to define a global platform for your project\nplatform :ios, '11.0'\n\n# CocoaPods analytics sends ne"
},
{
"path": "example/ios/Runner/AppDelegate.h",
"chars": 103,
"preview": "#import <Flutter/Flutter.h>\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : FlutterAppDelegate\n\n@end\n"
},
{
"path": "example/ios/Runner/AppDelegate.m",
"chars": 424,
"preview": "#include \"AppDelegate.h\"\n#include \"GeneratedPluginRegistrant.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApp"
},
{
"path": "example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json",
"chars": 2519,
"preview": "{\n \"images\" : [\n {\n \"size\" : \"20x20\",\n \"idiom\" : \"iphone\",\n \"filename\" : \"Icon-App-20x20@2x.png\",\n "
},
{
"path": "example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json",
"chars": 391,
"preview": "{\n \"images\" : [\n {\n \"idiom\" : \"universal\",\n \"filename\" : \"LaunchImage.png\",\n \"scale\" : \"1x\"\n },\n "
},
{
"path": "example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md",
"chars": 336,
"preview": "# Launch Screen Assets\n\nYou can customize the launch screen with your own desired assets by replacing the image files in"
},
{
"path": "example/ios/Runner/Base.lproj/LaunchScreen.storyboard",
"chars": 2377,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
},
{
"path": "example/ios/Runner/Base.lproj/Main.storyboard",
"chars": 1605,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
},
{
"path": "example/ios/Runner/Info.plist",
"chars": 1660,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "example/ios/Runner/main.m",
"chars": 226,
"preview": "#import <Flutter/Flutter.h>\n#import <UIKit/UIKit.h>\n#import \"AppDelegate.h\"\n\nint main(int argc, char* argv[]) {\n @autor"
},
{
"path": "example/ios/Runner.xcodeproj/project.pbxproj",
"chars": 22555,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
"chars": 135,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"self:\">\n </FileRef"
},
{
"path": "example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme",
"chars": 3331,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n LastUpgradeVersion = \"0910\"\n version = \"1.3\">\n <BuildAction\n "
},
{
"path": "example/ios/Runner.xcworkspace/contents.xcworkspacedata",
"chars": 224,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"group:Runner.xcodepr"
},
{
"path": "example/lib/main.dart",
"chars": 7912,
"preview": "import 'dart:ui';\n\nimport 'package:firebase_ml_vision/firebase_ml_vision.dart';\nimport 'package:flutter/material.dart';\n"
},
{
"path": "example/lib/main_face.dart",
"chars": 3632,
"preview": "import 'package:camera/camera.dart';\nimport 'package:firebase_ml_vision/firebase_ml_vision.dart';\nimport 'package:flutte"
},
{
"path": "example/lib/main_live.dart",
"chars": 3817,
"preview": "import 'package:firebase_ml_vision/firebase_ml_vision.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flu"
},
{
"path": "example/pubspec.yaml",
"chars": 2706,
"preview": "name: example\ndescription: A new Flutter project.\n\n# The following defines the version and build number for your applica"
},
{
"path": "example/test/widget_test.dart",
"chars": 1100,
"preview": "// This is a basic Flutter widget test.\n//\n// To perform an interaction with a widget in your test, use the WidgetTester"
},
{
"path": "flutter_camera_ml_vision.iml",
"chars": 982,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "lib/flutter_camera_ml_vision.dart",
"chars": 10066,
"preview": "library flutter_camera_ml_vision;\n\nimport 'dart:async';\nimport 'dart:io';\nimport 'dart:typed_data';\nimport 'dart:ui';\n\ni"
},
{
"path": "lib/utils.dart",
"chars": 1613,
"preview": "part of 'flutter_camera_ml_vision.dart';\n\nFuture<CameraDescription?> _getCamera(CameraLensDirection dir) async {\n final"
},
{
"path": "pubspec.yaml",
"chars": 779,
"preview": "name: flutter_camera_ml_vision\ndescription: A flutter widget that show the camera stream and allow ML vision recognition"
},
{
"path": "test/flutter_camera_ml_vision_test.dart",
"chars": 145,
"preview": "// import 'package:flutter_test/flutter_test.dart';\n\n// import 'package:flutter_camera_ml_vision/flutter_camera_ml_visio"
}
]
About this extraction
This page contains the full source code of the rushio-consulting/flutter_camera_ml_vision GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 49 files (89.4 KB), approximately 25.8k tokens, and a symbol index with 78 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.