├── ios ├── Assets │ └── .gitkeep ├── Classes │ ├── BarcodeScanPlugin.h │ ├── BarcodeScannerViewControllerDelegate.swift │ ├── BarcodeScanPlugin.m │ ├── SwiftBarcodeScanPlugin.swift │ ├── ScannerOverlay.swift │ ├── BarcodeScannerViewController.swift │ └── protos │ │ └── protos.pb.swift ├── .gitignore └── barcode_scan.podspec ├── android ├── settings.gradle ├── .gitignore ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── de │ │ └── mintware │ │ └── barcode_scan │ │ ├── ZXingAutofocusScannerView.kt │ │ ├── ScanResultHandler.kt │ │ ├── RequestCameraPermissionHandler.kt │ │ ├── BarcodeScanPlugin.kt │ │ ├── ActivityHelper.kt │ │ ├── ChannelHandler.kt │ │ └── BarcodeScannerActivity.kt └── build.gradle ├── example ├── analysis_options.yaml ├── ios │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ ├── .gitignore │ └── Podfile ├── android │ ├── gradle.properties │ ├── .gitignore │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── de │ │ │ │ │ │ └── mintware │ │ │ │ │ │ └── barcode_scan_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── build.gradle │ ├── android.iml │ └── barcode_scan_example_android.iml ├── README.md ├── .gitignore ├── .metadata ├── test │ └── widget_test.dart ├── android.iml ├── barcode_scan_example.iml ├── barcode_scan_example_android.iml ├── pubspec.yaml └── lib │ └── main.dart ├── test └── barcode_scan_test.dart ├── lib ├── model │ ├── model.dart │ ├── android_options.dart │ ├── scan_result.dart │ └── scan_options.dart ├── barcode_scan.dart ├── gen │ └── protos │ │ ├── protos.pbserver.dart │ │ ├── protos.pbenum.dart │ │ ├── protos.pbjson.dart │ │ └── protos.pb.dart └── platform_wrapper.dart ├── .gitignore ├── analysis_options.yaml ├── .metadata ├── protos ├── barcode_format.proto ├── android_configuration.proto ├── configuration.proto ├── scan_result.proto └── protos.proto ├── pubspec.yaml ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── generate_proto.sh ├── barcode_scan.iml ├── LICENSE ├── UPGRADE.md ├── barcode_scan_android.iml ├── CHANGELOG.md └── README.md /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'barcode_scan' 2 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /test/barcode_scan_test.dart: -------------------------------------------------------------------------------- 1 | void main() { 2 | // todo 3 | } 4 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/Classes/BarcodeScanPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface BarcodeScanPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /lib/model/model.dart: -------------------------------------------------------------------------------- 1 | library mintware.barcode_scan; 2 | 3 | export 'android_options.dart'; 4 | export 'scan_options.dart'; 5 | export 'scan_result.dart'; 6 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | gradle-wrapper.jar 3 | /.gradle 4 | /captures/ 5 | /gradlew 6 | /gradlew.bat 7 | /local.properties 8 | GeneratedPluginRegistrant.java 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .idea 4 | .packages 5 | .dart_tool/ 6 | .pub/ 7 | build/ 8 | ios/.generated/ 9 | packages 10 | pubspec.lock 11 | example/ios/Podfile.lock 12 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/barcode_scan.dart: -------------------------------------------------------------------------------- 1 | library mintware.barcode_scan; 2 | 3 | export 'gen/protos/protos.pb.dart' show BarcodeFormat, ResultType; 4 | 5 | export 'model/model.dart'; 6 | export 'platform_wrapper.dart'; 7 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mintware-de/flutter_barcode_reader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # barcode_scan_example 2 | 3 | Demonstrates how to use the barcode_scan plugin. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our online 8 | [documentation](http://flutter.io/). 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 6 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/gen/protos/protos.pbserver.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: protos/protos.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | export 'protos.pb.dart'; 9 | 10 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:effective_dart/analysis_options.yaml 2 | 3 | # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. 4 | # Uncomment to specify additional rules. 5 | # linter: 6 | # rules: 7 | # - camel_case_types 8 | 9 | analyzer: 10 | exclude: 11 | - lib/gen/** 12 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .idea 4 | .packages 5 | .pub/ 6 | build/ 7 | ios/.generated/ 8 | packages 9 | pubspec.lock 10 | .flutter-plugins 11 | .flutter-plugins-dependencies 12 | ios/Flutter.podspec 13 | ios/Flutter/Flutter.podspec 14 | ios/Flutter/flutter_export_environment.sh 15 | ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | 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. -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /protos/barcode_format.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package de.mintware.barcode_scan; 3 | option java_package = "de.mintware.barcode_scan"; 4 | 5 | enum BarcodeFormat { 6 | unknown = 0; 7 | aztec = 1; 8 | code39 = 2; 9 | code93 = 3; 10 | ean8 = 4; 11 | ean13 = 5; 12 | code128 = 6; 13 | dataMatrix = 7; 14 | qr = 8; 15 | interleaved2of5 = 9; 16 | upce = 10; 17 | pdf417 = 11; 18 | } -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | void main() { 9 | // todo 10 | } 11 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: barcode_scan 2 | description: A flutter plugin for scanning 2D barcodes and QRCodes via camera. 3 | version: 3.0.1 4 | homepage: https://github.com/mintware-de/flutter_barcode_reader 5 | 6 | dependencies: 7 | protobuf: ^1.0.1 8 | flutter: 9 | sdk: flutter 10 | 11 | dev_dependencies: 12 | effective_dart: ^1.2.0 13 | 14 | environment: 15 | sdk: ">=2.1.0 <3.0.0" 16 | 17 | flutter: 18 | plugin: 19 | androidPackage: de.mintware.barcode_scan 20 | pluginClass: BarcodeScanPlugin -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/de/mintware/barcode_scan_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan_example 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Classes/BarcodeScannerViewControllerDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarcodeScannerViewControllerDelegate.swift 3 | // barcode_scan 4 | // 5 | // Created by Julian Finkler on 20.02.20. 6 | // 7 | import Foundation 8 | 9 | protocol BarcodeScannerViewControllerDelegate { 10 | func didScanBarcodeWithResult(_ controller: BarcodeScannerViewController?, 11 | scanResult: ScanResult 12 | ) 13 | 14 | func didFailWithErrorCode(_ controller: BarcodeScannerViewController?, 15 | errorCode: String 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /protos/android_configuration.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package de.mintware.barcode_scan; 3 | option java_package = "de.mintware.barcode_scan"; 4 | 5 | message AndroidConfiguration { 6 | // You can optionally set aspect ratio tolerance level 7 | // that is used in calculating the optimal Camera preview size. 8 | // On several Huawei devices you need to set this to 0.5. 9 | // This parameter is only supported on Android devices. 10 | double aspectTolerance = 1; 11 | 12 | // Set to true to enable auto focus 13 | // This parameter is only supported on Android devices. 14 | bool useAutoFocus = 2; 15 | } -------------------------------------------------------------------------------- /example/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Classes/BarcodeScanPlugin.m: -------------------------------------------------------------------------------- 1 | #import "BarcodeScanPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "barcode_scan-Swift.h" 9 | #endif 10 | 11 | @implementation BarcodeScanPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftBarcodeScanPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /lib/model/android_options.dart: -------------------------------------------------------------------------------- 1 | /// Android specific scan options 2 | class AndroidOptions { 3 | /// You can optionally set aspect ratio tolerance level 4 | /// that is used in calculating the optimal Camera preview size. 5 | /// This parameter is only supported on Android devices. 6 | final double aspectTolerance; 7 | 8 | /// Set to true to enable auto focus 9 | /// This parameter is only supported on Android devices. 10 | final bool useAutoFocus; 11 | 12 | /// Create Android specific scan options 13 | const AndroidOptions({ 14 | this.aspectTolerance = 0.5, 15 | this.useAutoFocus = true, 16 | }) : assert(aspectTolerance != null), 17 | assert(useAutoFocus != null); 18 | } 19 | -------------------------------------------------------------------------------- /protos/configuration.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package de.mintware.barcode_scan; 3 | import "android_configuration.proto"; 4 | import "barcode_format.proto"; 5 | 6 | message Configuration { 7 | // Strings which are displayed to the user 8 | map strings = 1; 9 | 10 | // Restricts the barcode format which should be read 11 | repeated BarcodeFormat restrictFormat = 2; 12 | 13 | // Index of the camera which should used. -1 uses the default camera 14 | int32 useCamera = 3; 15 | 16 | // Android specific configuration 17 | AndroidConfiguration android = 4; 18 | 19 | // Set to true to automatically enable flash on camera start 20 | bool autoEnableFlash = 5; 21 | } 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[Feature Request]" 5 | labels: Feature 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /protos/scan_result.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package de.mintware.barcode_scan; 3 | option java_package = "de.mintware.barcode_scan"; 4 | 5 | import "barcode_format.proto"; 6 | 7 | enum ResultType { 8 | Barcode = 0; 9 | Cancelled = 1; 10 | Error = 2; 11 | } 12 | 13 | message ScanResult { 14 | // Represents the type of the result 15 | ResultType type = 1; 16 | 17 | // The barcode itself if the result type is barcode. 18 | // If the result type is error it contains the error message 19 | string rawContent = 2; 20 | 21 | // The barcode format 22 | BarcodeFormat format = 3; 23 | 24 | // If the format is unknown, this field holds additional information 25 | string formatNote = 4; 26 | } 27 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.61' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | build/ 6 | 7 | .DS_Store 8 | *.swp 9 | *.pyc 10 | 11 | *.mode1v3 12 | *.mode2v3 13 | *.moved-aside 14 | *.pbxuser 15 | *.perspectivev3 16 | **/*sync/ 17 | .sconsign.dblite 18 | .tags* 19 | **/.vagrant/ 20 | **/DerivedData/ 21 | Icon? 22 | **/Pods/ 23 | **/.symlinks/ 24 | profile 25 | xcuserdata 26 | **/.generated/ 27 | Flutter/App.framework 28 | Flutter/Flutter.framework 29 | Flutter/Flutter.podspec 30 | Flutter/Generated.xcconfig 31 | Flutter/app.flx 32 | Flutter/app.zip 33 | Flutter/flutter_assets/ 34 | Flutter/flutter_export_environment.sh 35 | ServiceDefinitions.json 36 | Runner/GeneratedPluginRegistrant.* 37 | 38 | # Exceptions to above rules. 39 | !default.mode1v3 40 | !default.mode2v3 41 | !default.pbxuser 42 | !default.perspectivev3 43 | -------------------------------------------------------------------------------- /generate_proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PROTO_OUT_FILE="./protos/protos.proto" 3 | 4 | if [ -f "$PROTO_OUT_FILE" ]; then 5 | echo "Deleting old $PROTO_OUT_FILE" 6 | rm "$PROTO_OUT_FILE"; 7 | fi 8 | 9 | cat << HEADER > "$PROTO_OUT_FILE" 10 | // AUTO GENERATED FILE, DO NOT EDIT! 11 | // 12 | // Generated by $0 13 | 14 | syntax = "proto3"; 15 | option java_package = "de.mintware.barcode_scan"; 16 | HEADER 17 | 18 | echo $FILE_HEADER >> $PROTO_OUT_FILE; 19 | 20 | for f in protos/*.proto; do 21 | if [ "./$f" = $PROTO_OUT_FILE ]; then 22 | continue ; 23 | fi; 24 | ( 25 | echo "// $f"; 26 | ## Remove duplicate headers 27 | cat $f | sed -E 's#^(syntax|package|option|import).+$##' | sed '/^$/d'; 28 | echo '' 29 | ) >> $PROTO_OUT_FILE; 30 | done 31 | 32 | 33 | protoc \ 34 | --dart_out="./lib/gen" \ 35 | --swift_out=./ios/Classes \ 36 | "$PROTO_OUT_FILE" 37 | 38 | -------------------------------------------------------------------------------- /lib/model/scan_result.dart: -------------------------------------------------------------------------------- 1 | import '../gen/protos/protos.pb.dart'; 2 | 3 | /// Represents the result of a scan 4 | class ScanResult { 5 | /// Represents the type of the result 6 | ResultType type; 7 | 8 | /// The barcode itself if the result type is barcode. 9 | /// If the result type is error it contains the error message 10 | String rawContent; 11 | 12 | /// The barcode format 13 | BarcodeFormat format; 14 | 15 | /// If the format is unknown, this field holds additional information 16 | String formatNote; 17 | 18 | /// Creates a new scan result 19 | ScanResult({ 20 | this.type = ResultType.Barcode, 21 | this.rawContent = "", 22 | this.format = BarcodeFormat.unknown, 23 | this.formatNote = "", 24 | }) : assert(type != null), 25 | assert(rawContent != null), 26 | assert(format != null), 27 | assert(formatNote != null); 28 | } 29 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /example/barcode_scan_example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ios/barcode_scan.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint barcode_scan.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'barcode_scan' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.dependency 'MTBBarcodeScanner' 19 | s.dependency 'SwiftProtobuf' 20 | s.platform = :ios, '8.0' 21 | 22 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. 23 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } 24 | s.swift_version = '5.0' 25 | end 26 | -------------------------------------------------------------------------------- /barcode_scan.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[Bug]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **BUG REPORTS WITHOUT PROVIDING THESE INFORMATIONS WILL BE CLOSED DIRECTLY. DON'T REMOVE THE SECTIONS!** 11 | 12 | 13 | **Describe the bug** 14 | A clear and concise description of what the bug is. 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 1. Go to '...' 19 | 2. Click on '....' 20 | 3. Scroll down to '....' 21 | 4. See error 22 | 23 | **Expected behavior** 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Screenshots** 27 | If applicable, add screenshots to help explain your problem. 28 | 29 | **Logs** 30 | If applicable, add the verbose output of `flutter run`. 31 | 32 | **Environment (please complete the following information):** 33 | - [ ] iOS? Version: ... 34 | - [ ] Android? Version: ... 35 | - [ ] Real Device? Which?: ... 36 | - [ ] Emulator/Simulator? Which?: ... 37 | - Version of `barcode_scan` 38 | - Output of `flutter --version`: 39 | ``` 40 | Flutter ... 41 | ``` 42 | 43 | **Additional context** 44 | Add any other context about the problem here. 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2020 Julian Finkler https://www.mintware.de 4 | Copyright (c) 2018-2019 AppTree Software http://www.apptreesoftware.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/ZXingAutofocusScannerView.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import android.content.Context 4 | import android.hardware.Camera 5 | import android.util.Log 6 | import me.dm7.barcodescanner.core.CameraWrapper 7 | import me.dm7.barcodescanner.zxing.ZXingScannerView 8 | 9 | class ZXingAutofocusScannerView(context: Context) : ZXingScannerView(context) { 10 | 11 | private var callbackFocus = false 12 | private var autofocusPresence = false 13 | 14 | override fun setupCameraPreview(cameraWrapper: CameraWrapper?) { 15 | cameraWrapper?.mCamera?.parameters?.let { parameters -> 16 | try { 17 | autofocusPresence = parameters.supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO); 18 | parameters.focusMode = Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE 19 | cameraWrapper.mCamera.parameters = parameters 20 | } catch (ex: Exception) { 21 | callbackFocus = true 22 | } 23 | } 24 | super.setupCameraPreview(cameraWrapper) 25 | } 26 | 27 | override fun setAutoFocus(state: Boolean) { 28 | //Fix to avoid crash on devices without autofocus (Issue #226) 29 | if(autofocusPresence){ 30 | super.setAutoFocus(callbackFocus) 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /lib/model/scan_options.dart: -------------------------------------------------------------------------------- 1 | import '../gen/protos/protos.pb.dart'; 2 | import '../model/android_options.dart'; 3 | 4 | /// Provides options to configure the barcode scanner 5 | class ScanOptions { 6 | /// This map contains strings which are displayed to the user 7 | /// 8 | /// Possible pairs: 9 | /// - cancel : The text of the cancel button (iOS only) 10 | // - flash_on : The text of the flash on button 11 | // - flash_off : The Text of the flash off button 12 | final Map strings; 13 | 14 | /// Restrict the supported barcode formats 15 | final List restrictFormat; 16 | 17 | /// Index of the camera which should used. -1 uses the default camera 18 | final int useCamera; 19 | 20 | /// Android specific configuration 21 | final AndroidOptions android; 22 | 23 | /// Set to true to automatically enable flash on camera start 24 | final bool autoEnableFlash; 25 | 26 | /// Create a object which represents the scanner options 27 | const ScanOptions({ 28 | this.restrictFormat = const [], 29 | this.useCamera = -1, 30 | this.android = const AndroidOptions(), 31 | this.autoEnableFlash = false, 32 | this.strings = const { 33 | "cancel": "Cancel", 34 | "flash_on": "Flash on", 35 | "flash_off": "Flash off", 36 | }, 37 | }) : assert(restrictFormat != null), 38 | assert(useCamera != null), 39 | assert(useCamera >= -1), 40 | assert(android != null); 41 | } 42 | -------------------------------------------------------------------------------- /example/barcode_scan_example_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/ScanResultHandler.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import io.flutter.plugin.common.MethodChannel 6 | import io.flutter.plugin.common.PluginRegistry.ActivityResultListener 7 | 8 | class ScanResultHandler(private val result: MethodChannel.Result) : ActivityResultListener { 9 | 10 | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean { 11 | 12 | var scanResult = ByteArray(0) 13 | when (resultCode) { 14 | Activity.RESULT_OK -> { 15 | scanResult = data?.getByteArrayExtra(BarcodeScannerActivity.EXTRA_RESULT) 16 | ?: scanResult 17 | } 18 | Activity.RESULT_CANCELED -> { 19 | scanResult = Protos.ScanResult.newBuilder() 20 | .setType(Protos.ResultType.Cancelled) 21 | .build() 22 | .toByteArray() 23 | } 24 | else -> { 25 | val errorCode = data?.getStringExtra(BarcodeScannerActivity.EXTRA_ERROR_CODE) 26 | scanResult = Protos.ScanResult.newBuilder() 27 | .setType(Protos.ResultType.Error) 28 | .setFormat(Protos.BarcodeFormat.unknown) 29 | .setRawContent(errorCode) 30 | .build() 31 | .toByteArray() 32 | } 33 | } 34 | result.success(scanResult) 35 | 36 | return true 37 | } 38 | } -------------------------------------------------------------------------------- /UPGRADE.md: -------------------------------------------------------------------------------- 1 | # Upgrade from 2.x to 3.0.0 2 | 3 | - The `BarcodeScan.scan()` method returns a [`ScanResult`](./lib/model/scan_result.dart). 4 | The barcode is stored in `ScanResult.rawContent` 5 | Check your calls to this method and read the barcode from the `rawContent` property. 6 | - The following static strings of class `BarcodeScanner` are now written in camelCase (as opposed to PascalCase like before): 7 | - `cameraAccessGranted` 8 | - `cameraAccessDenied` 9 | 10 | If your project uses pre Flutter 1.12 you need to update Flutter in your App: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects 11 | 12 | 13 | # Upgrade from 1.0.0 to 2.0.0 14 | 15 | The simples way for upgrading is by replacing: 16 | - `com.apptreesoftware.barcodescan` 17 | - `com.yourcompany.barcodescan` 18 | - `com.apptreesoftware.barcode_scan` 19 | 20 | With: `de.mintware.barcode_scan` 21 | 22 | Detailed changes: 23 | Android: 24 | Kotlin Package: `com.apptreesoftware.barcodescan` -> `de.mintware.barcode_scan` 25 | Manifest-Package: `com.yourcompany.barcodescan` -> `de.mintware.barcodescan` 26 | Activity: `com.apptreesoftware.barcodescan.BarcodeScannerActivity` -> `de.mintware.barcode_scan.BarcodeScannerActivity` 27 | 28 | iOS: 29 | Bundle ID: `com.apptreesoftware.barcode.plugin.example` -> `de.mintware.barcode_scan.plugin.example` 30 | 31 | Flutter: 32 | Method channel: `com.apptreesoftware.barcode_scan` -> `de.mintware.barcode_scan` 33 | pubspec.yaml: 34 | - homepage updated 35 | - deprecated author entry removed 36 | - comments removed 37 | - flutter.plugin.androidPackage: `com.apptreesoftware.barcode_scan` -> `de.mintware.barcode_scan` 38 | -------------------------------------------------------------------------------- /barcode_scan_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/barcode_scan_example_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | barcode_scan_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | NSCameraUsageDescription 26 | Camera permission is required for barcode scanning. 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/RequestCameraPermissionHandler.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import android.content.pm.PackageManager 4 | import de.mintware.barcode_scan.ActivityHelper.Companion.REQ_CAMERA_PERMISSION 5 | import io.flutter.plugin.common.EventChannel 6 | import io.flutter.plugin.common.PluginRegistry 7 | 8 | class RequestCameraPermissionHandler(private val sink: EventChannel.EventSink? 9 | ) : PluginRegistry.RequestPermissionsResultListener { 10 | 11 | override fun onRequestPermissionsResult(requestCode: Int, 12 | permissions: Array?, 13 | grantResults: IntArray? 14 | ): Boolean { 15 | if (requestCode != REQ_CAMERA_PERMISSION) { 16 | return false 17 | } 18 | 19 | if (verifyPermissions(grantResults)) { 20 | sink?.success("PERMISSION_GRANTED") 21 | } else { 22 | sink?.success("PERMISSION_NOT_GRANTED") 23 | } 24 | return true 25 | } 26 | 27 | /** 28 | * Check that all given permissions have been granted by verifying that each entry in the 29 | * given array is of the value [PackageManager.PERMISSION_GRANTED]. 30 | 31 | * @see onRequestPermissionsResult 32 | */ 33 | private fun verifyPermissions(grantResults: IntArray?): Boolean { 34 | if (grantResults == null) { 35 | return false 36 | } 37 | // At least one result must be checked. 38 | if (grantResults.isEmpty()) { 39 | return false 40 | } 41 | 42 | // Verify that each required permission has been granted, otherwise return false. 43 | for (result in grantResults) { 44 | if (result != PackageManager.PERMISSION_GRANTED) { 45 | return false 46 | } 47 | } 48 | return true 49 | } 50 | } -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'de.mintware.barcode_scan' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.3.61' 6 | ext.protobuf_version = '0.8.8' 7 | repositories { 8 | google() 9 | jcenter() 10 | } 11 | 12 | dependencies { 13 | classpath 'com.android.tools.build:gradle:3.5.3' 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 15 | classpath "com.google.protobuf:protobuf-gradle-plugin:$protobuf_version" 16 | } 17 | } 18 | 19 | rootProject.allprojects { 20 | repositories { 21 | google() 22 | jcenter() 23 | } 24 | } 25 | 26 | apply plugin: 'com.android.library' 27 | apply plugin: 'kotlin-android' 28 | apply plugin: 'com.google.protobuf' 29 | 30 | android { 31 | compileSdkVersion 29 32 | 33 | sourceSets { 34 | main.java.srcDirs += 'src/main/kotlin' 35 | main.proto.srcDirs += '../protos' 36 | } 37 | defaultConfig { 38 | minSdkVersion 18 39 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 40 | } 41 | lintOptions { 42 | disable 'InvalidPackage' 43 | } 44 | } 45 | 46 | 47 | protobuf { 48 | // Configure the protoc executable 49 | protoc { 50 | // Download from repositories 51 | artifact = 'com.google.protobuf:protoc:3.11.4' 52 | } 53 | plugins { 54 | javalite { 55 | // The codegen for lite comes as a separate artifact 56 | artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0' 57 | } 58 | } 59 | generateProtoTasks { 60 | all().each { task -> 61 | task.plugins { 62 | javalite { } 63 | } 64 | } 65 | } 66 | } 67 | 68 | dependencies { 69 | implementation 'androidx.appcompat:appcompat:1.1.0' 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | implementation 'me.dm7.barcodescanner:zxing:1.9.13' 72 | implementation 'com.google.protobuf:protobuf-lite:3.0.1' 73 | api 'com.google.android.material:material:1.1.0' 74 | } 75 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: barcode_scan_example 2 | description: Demonstrates how to use the barcode_scan plugin. 3 | 4 | dependencies: 5 | flutter: 6 | sdk: flutter 7 | 8 | # The following adds the Cupertino Icons font to your application. 9 | # Use with the CupertinoIcons class for iOS style icons. 10 | cupertino_icons: ^0.1.0 11 | 12 | dev_dependencies: 13 | flutter_test: 14 | sdk: flutter 15 | 16 | barcode_scan: 17 | path: ../ 18 | effective_dart: ^1.2.0 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://www.dartlang.org/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter. 24 | flutter: 25 | 26 | # The following line ensures that the Material Icons font is 27 | # included with your application, so that you can use the icons in 28 | # the material Icons class. 29 | uses-material-design: true 30 | 31 | # To add assets to your application, add an assets section, like this: 32 | # assets: 33 | # - images/a_dot_burr.jpeg 34 | # - images/a_dot_ham.jpeg 35 | 36 | # An image asset can refer to one or more resolution-specific "variants", see 37 | # https://flutter.io/assets-and-images/#resolution-aware. 38 | 39 | # For details regarding adding assets from package dependencies, see 40 | # https://flutter.io/assets-and-images/#from-packages 41 | 42 | # To add custom fonts to your application, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | # fonts: 48 | # - family: Schyler 49 | # fonts: 50 | # - asset: fonts/Schyler-Regular.ttf 51 | # - asset: fonts/Schyler-Italic.ttf 52 | # style: italic 53 | # - family: Trajan Pro 54 | # fonts: 55 | # - asset: fonts/TrajanPro.ttf 56 | # - asset: fonts/TrajanPro_Bold.ttf 57 | # weight: 700 58 | # 59 | # For details regarding fonts from package dependencies, 60 | # see https://flutter.io/custom-fonts/#from-packages 61 | -------------------------------------------------------------------------------- /protos/protos.proto: -------------------------------------------------------------------------------- 1 | // AUTO GENERATED FILE, DO NOT EDIT! 2 | // 3 | // Generated by ./generate_proto.sh 4 | 5 | syntax = "proto3"; 6 | option java_package = "de.mintware.barcode_scan"; 7 | 8 | // protos/android_configuration.proto 9 | message AndroidConfiguration { 10 | // You can optionally set aspect ratio tolerance level 11 | // that is used in calculating the optimal Camera preview size. 12 | // On several Huawei devices you need to set this to 0.5. 13 | // This parameter is only supported on Android devices. 14 | double aspectTolerance = 1; 15 | // Set to true to enable auto focus 16 | // This parameter is only supported on Android devices. 17 | bool useAutoFocus = 2; 18 | } 19 | 20 | // protos/barcode_format.proto 21 | enum BarcodeFormat { 22 | unknown = 0; 23 | aztec = 1; 24 | code39 = 2; 25 | code93 = 3; 26 | ean8 = 4; 27 | ean13 = 5; 28 | code128 = 6; 29 | dataMatrix = 7; 30 | qr = 8; 31 | interleaved2of5 = 9; 32 | upce = 10; 33 | pdf417 = 11; 34 | } 35 | 36 | // protos/configuration.proto 37 | message Configuration { 38 | // Strings which are displayed to the user 39 | map strings = 1; 40 | // Restricts the barcode format which should be read 41 | repeated BarcodeFormat restrictFormat = 2; 42 | // Index of the camera which should used. -1 uses the default camera 43 | int32 useCamera = 3; 44 | // Android specific configuration 45 | AndroidConfiguration android = 4; 46 | // Set to true to automatically enable flash on camera start 47 | bool autoEnableFlash = 5; 48 | } 49 | 50 | // protos/scan_result.proto 51 | enum ResultType { 52 | Barcode = 0; 53 | Cancelled = 1; 54 | Error = 2; 55 | } 56 | message ScanResult { 57 | // Represents the type of the result 58 | ResultType type = 1; 59 | // The barcode itself if the result type is barcode. 60 | // If the result type is error it contains the error message 61 | string rawContent = 2; 62 | // The barcode format 63 | BarcodeFormat format = 3; 64 | // If the format is unknown, this field holds additional information 65 | string formatNote = 4; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "de.mintware.barcode_scan_example" 42 | minSdkVersion 18 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/gen/protos/protos.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: protos/protos.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | // ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME 9 | import 'dart:core' as $core; 10 | import 'package:protobuf/protobuf.dart' as $pb; 11 | 12 | class BarcodeFormat extends $pb.ProtobufEnum { 13 | static const BarcodeFormat unknown = BarcodeFormat._(0, 'unknown'); 14 | static const BarcodeFormat aztec = BarcodeFormat._(1, 'aztec'); 15 | static const BarcodeFormat code39 = BarcodeFormat._(2, 'code39'); 16 | static const BarcodeFormat code93 = BarcodeFormat._(3, 'code93'); 17 | static const BarcodeFormat ean8 = BarcodeFormat._(4, 'ean8'); 18 | static const BarcodeFormat ean13 = BarcodeFormat._(5, 'ean13'); 19 | static const BarcodeFormat code128 = BarcodeFormat._(6, 'code128'); 20 | static const BarcodeFormat dataMatrix = BarcodeFormat._(7, 'dataMatrix'); 21 | static const BarcodeFormat qr = BarcodeFormat._(8, 'qr'); 22 | static const BarcodeFormat interleaved2of5 = BarcodeFormat._(9, 'interleaved2of5'); 23 | static const BarcodeFormat upce = BarcodeFormat._(10, 'upce'); 24 | static const BarcodeFormat pdf417 = BarcodeFormat._(11, 'pdf417'); 25 | 26 | static const $core.List values = [ 27 | unknown, 28 | aztec, 29 | code39, 30 | code93, 31 | ean8, 32 | ean13, 33 | code128, 34 | dataMatrix, 35 | qr, 36 | interleaved2of5, 37 | upce, 38 | pdf417, 39 | ]; 40 | 41 | static final $core.Map<$core.int, BarcodeFormat> _byValue = $pb.ProtobufEnum.initByValue(values); 42 | static BarcodeFormat valueOf($core.int value) => _byValue[value]; 43 | 44 | const BarcodeFormat._($core.int v, $core.String n) : super(v, n); 45 | } 46 | 47 | class ResultType extends $pb.ProtobufEnum { 48 | static const ResultType Barcode = ResultType._(0, 'Barcode'); 49 | static const ResultType Cancelled = ResultType._(1, 'Cancelled'); 50 | static const ResultType Error = ResultType._(2, 'Error'); 51 | 52 | static const $core.List values = [ 53 | Barcode, 54 | Cancelled, 55 | Error, 56 | ]; 57 | 58 | static final $core.Map<$core.int, ResultType> _byValue = $pb.ProtobufEnum.initByValue(values); 59 | static ResultType valueOf($core.int value) => _byValue[value]; 60 | 61 | const ResultType._($core.int v, $core.String n) : super(v, n); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /lib/gen/protos/protos.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: protos/protos.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | const BarcodeFormat$json = const { 9 | '1': 'BarcodeFormat', 10 | '2': const [ 11 | const {'1': 'unknown', '2': 0}, 12 | const {'1': 'aztec', '2': 1}, 13 | const {'1': 'code39', '2': 2}, 14 | const {'1': 'code93', '2': 3}, 15 | const {'1': 'ean8', '2': 4}, 16 | const {'1': 'ean13', '2': 5}, 17 | const {'1': 'code128', '2': 6}, 18 | const {'1': 'dataMatrix', '2': 7}, 19 | const {'1': 'qr', '2': 8}, 20 | const {'1': 'interleaved2of5', '2': 9}, 21 | const {'1': 'upce', '2': 10}, 22 | const {'1': 'pdf417', '2': 11}, 23 | ], 24 | }; 25 | 26 | const ResultType$json = const { 27 | '1': 'ResultType', 28 | '2': const [ 29 | const {'1': 'Barcode', '2': 0}, 30 | const {'1': 'Cancelled', '2': 1}, 31 | const {'1': 'Error', '2': 2}, 32 | ], 33 | }; 34 | 35 | const AndroidConfiguration$json = const { 36 | '1': 'AndroidConfiguration', 37 | '2': const [ 38 | const {'1': 'aspectTolerance', '3': 1, '4': 1, '5': 1, '10': 'aspectTolerance'}, 39 | const {'1': 'useAutoFocus', '3': 2, '4': 1, '5': 8, '10': 'useAutoFocus'}, 40 | ], 41 | }; 42 | 43 | const Configuration$json = const { 44 | '1': 'Configuration', 45 | '2': const [ 46 | const {'1': 'strings', '3': 1, '4': 3, '5': 11, '6': '.Configuration.StringsEntry', '10': 'strings'}, 47 | const {'1': 'restrictFormat', '3': 2, '4': 3, '5': 14, '6': '.BarcodeFormat', '10': 'restrictFormat'}, 48 | const {'1': 'useCamera', '3': 3, '4': 1, '5': 5, '10': 'useCamera'}, 49 | const {'1': 'android', '3': 4, '4': 1, '5': 11, '6': '.AndroidConfiguration', '10': 'android'}, 50 | const {'1': 'autoEnableFlash', '3': 5, '4': 1, '5': 8, '10': 'autoEnableFlash'}, 51 | ], 52 | '3': const [Configuration_StringsEntry$json], 53 | }; 54 | 55 | const Configuration_StringsEntry$json = const { 56 | '1': 'StringsEntry', 57 | '2': const [ 58 | const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, 59 | const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, 60 | ], 61 | '7': const {'7': true}, 62 | }; 63 | 64 | const ScanResult$json = const { 65 | '1': 'ScanResult', 66 | '2': const [ 67 | const {'1': 'type', '3': 1, '4': 1, '5': 14, '6': '.ResultType', '10': 'type'}, 68 | const {'1': 'rawContent', '3': 2, '4': 1, '5': 9, '10': 'rawContent'}, 69 | const {'1': 'format', '3': 3, '4': 1, '5': 14, '6': '.BarcodeFormat', '10': 'format'}, 70 | const {'1': 'formatNote', '3': 4, '4': 1, '5': 9, '10': 'formatNote'}, 71 | ], 72 | }; 73 | 74 | -------------------------------------------------------------------------------- /ios/Classes/SwiftBarcodeScanPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import SwiftProtobuf 4 | import AVFoundation 5 | 6 | public class SwiftBarcodeScanPlugin: NSObject, FlutterPlugin, BarcodeScannerViewControllerDelegate { 7 | 8 | private var result: FlutterResult? 9 | private var hostViewController: UIViewController? 10 | 11 | public static func register(with registrar: FlutterPluginRegistrar) { 12 | let channel = FlutterMethodChannel(name: "de.mintware.barcode_scan", binaryMessenger: registrar.messenger()) 13 | let instance = SwiftBarcodeScanPlugin() 14 | instance.hostViewController = UIApplication.shared.delegate?.window??.rootViewController 15 | registrar.addMethodCallDelegate(instance, channel: channel) 16 | } 17 | 18 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 19 | self.result = result 20 | if ("scan" == call.method) { 21 | let configuration: Configuration? = getPayload(call: call) 22 | showBarcodeView(config: configuration)} 23 | else if ("numberOfCameras" == call.method) { 24 | result(AVCaptureDevice.devices(for: .video).count) 25 | } else if ("requestCameraPermission" == call.method) { 26 | result(false) 27 | } else { 28 | result(FlutterMethodNotImplemented) 29 | } 30 | } 31 | 32 | private func showBarcodeView(config: Configuration? = nil) { 33 | let scannerViewController = BarcodeScannerViewController() 34 | 35 | let navigationController = UINavigationController(rootViewController: scannerViewController) 36 | 37 | if #available(iOS 13.0, *) { 38 | navigationController.modalPresentationStyle = .fullScreen 39 | } 40 | 41 | if let config = config { 42 | scannerViewController.config = config 43 | } 44 | scannerViewController.delegate = self 45 | hostViewController?.present(navigationController, animated: false) 46 | } 47 | 48 | private func getPayload(call: FlutterMethodCall) -> T? { 49 | 50 | if(call.arguments == nil || !(call.arguments is FlutterStandardTypedData)) { 51 | return nil 52 | } 53 | do { 54 | let configuration = try T(serializedData: (call.arguments as! FlutterStandardTypedData).data) 55 | return configuration 56 | } catch { 57 | } 58 | return nil 59 | } 60 | 61 | func didScanBarcodeWithResult(_ controller: BarcodeScannerViewController?, scanResult: ScanResult) { 62 | do { 63 | result?(try scanResult.serializedData()) 64 | } catch { 65 | result?(FlutterError(code: "err_serialize", message: "Failed to serialize the result", details: nil)) 66 | } 67 | } 68 | 69 | func didFailWithErrorCode(_ controller: BarcodeScannerViewController?, errorCode: String) { 70 | result?(FlutterError(code: errorCode, message: nil, details: nil)) 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScanPlugin.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import androidx.annotation.NonNull 4 | import androidx.annotation.Nullable 5 | import io.flutter.embedding.engine.plugins.FlutterPlugin 6 | import io.flutter.embedding.engine.plugins.activity.ActivityAware 7 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding 8 | import io.flutter.plugin.common.PluginRegistry.Registrar 9 | 10 | /** BarcodeScanPlugin */ 11 | class BarcodeScanPlugin : FlutterPlugin, ActivityAware { 12 | 13 | @Nullable 14 | private var channelHandler: ChannelHandler? = null 15 | @Nullable 16 | private var activityHelper: ActivityHelper? = null 17 | 18 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 19 | activityHelper = ActivityHelper(flutterPluginBinding.applicationContext) 20 | 21 | channelHandler = ChannelHandler(activityHelper!!) 22 | channelHandler!!.startListening(flutterPluginBinding.binaryMessenger) 23 | } 24 | 25 | // This static function is optional and equivalent to onAttachedToEngine. It supports the old 26 | // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting 27 | // plugin registration via this function while apps migrate to use the new Android APIs 28 | // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. 29 | // 30 | // It is encouraged to share logic between onAttachedToEngine and registerWith to keep 31 | // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called 32 | // depending on the user's project. onAttachedToEngine or registerWith must both be defined 33 | // in the same class. 34 | companion object { 35 | @Suppress("unused") 36 | @JvmStatic 37 | fun registerWith(registrar: Registrar) { 38 | val handler = ChannelHandler(ActivityHelper( 39 | registrar.context(), 40 | registrar.activity() 41 | )) 42 | handler.startListening(registrar.messenger()) 43 | } 44 | } 45 | 46 | override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { 47 | if (channelHandler == null) { 48 | return 49 | } 50 | 51 | channelHandler!!.stopListening() 52 | channelHandler = null 53 | activityHelper = null 54 | } 55 | 56 | override fun onDetachedFromActivity() { 57 | if (channelHandler == null) { 58 | return 59 | } 60 | 61 | activityHelper!!.activity = null 62 | } 63 | 64 | override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { 65 | onAttachedToActivity(binding) 66 | } 67 | 68 | override fun onAttachedToActivity(binding: ActivityPluginBinding) { 69 | if (channelHandler == null) { 70 | return 71 | } 72 | binding.addActivityResultListener(activityHelper!!) 73 | binding.addRequestPermissionsResultListener(activityHelper!!) 74 | activityHelper!!.activity = binding.activity 75 | } 76 | 77 | override fun onDetachedFromActivityForConfigChanges() { 78 | onDetachedFromActivity() 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/platform_wrapper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io' show Platform; 3 | 4 | import 'package:flutter/services.dart'; 5 | 6 | import './model/model.dart'; 7 | import 'gen/protos/protos.pb.dart' as proto; 8 | 9 | // ignore: avoid_classes_with_only_static_members 10 | /// Barcode scanner plugin 11 | /// Simply call `var barcode = await BarcodeScanner.scan()` to scan a barcode 12 | class BarcodeScanner { 13 | /// If the user has granted the access to the camera this code is returned. 14 | static const cameraAccessGranted = 'PERMISSION_GRANTED'; 15 | 16 | /// If the user has not granted the access to the camera this code is thrown. 17 | static const cameraAccessDenied = 'PERMISSION_NOT_GRANTED'; 18 | 19 | /// The method channel 20 | static const MethodChannel _channel = 21 | MethodChannel('de.mintware.barcode_scan'); 22 | 23 | /// The event channel 24 | static const EventChannel _eventChannel = 25 | EventChannel('de.mintware.barcode_scan/events'); 26 | 27 | /// Starts the camera for scanning the barcode, shows a preview window and 28 | /// returns the barcode if one was scanned. 29 | /// Can throw an exception. 30 | /// See also [cameraAccessDenied] 31 | static Future scan({ 32 | ScanOptions options = const ScanOptions(), 33 | }) async { 34 | assert(options != null); 35 | if (Platform.isIOS) { 36 | return _doScan(options); 37 | } 38 | 39 | var events = _eventChannel.receiveBroadcastStream(); 40 | var completer = Completer(); 41 | 42 | StreamSubscription subscription; 43 | subscription = events.listen((event) async { 44 | if (event is String) { 45 | if (event == cameraAccessGranted) { 46 | subscription.cancel(); 47 | completer.complete(await _doScan(options)); 48 | } else if (event == cameraAccessDenied) { 49 | subscription.cancel(); 50 | completer.completeError(PlatformException(code: event)); 51 | } 52 | } 53 | }); 54 | 55 | var permissionsRequested = 56 | await _channel.invokeMethod('requestCameraPermission'); 57 | 58 | if (permissionsRequested) { 59 | return completer.future; 60 | } else { 61 | subscription.cancel(); 62 | return _doScan(options); 63 | } 64 | } 65 | 66 | static Future _doScan(ScanOptions options) async { 67 | var config = proto.Configuration() 68 | ..useCamera = options.useCamera 69 | ..restrictFormat.addAll(options.restrictFormat) 70 | ..autoEnableFlash = options.autoEnableFlash 71 | ..strings.addAll(options.strings) 72 | ..android = (proto.AndroidConfiguration() 73 | ..useAutoFocus = options.android.useAutoFocus 74 | ..aspectTolerance = options.android.aspectTolerance 75 | /**/) 76 | /**/; 77 | var buffer = await _channel.invokeMethod('scan', config?.writeToBuffer()); 78 | var tmpResult = proto.ScanResult.fromBuffer(buffer); 79 | return ScanResult( 80 | format: tmpResult.format, 81 | formatNote: tmpResult.formatNote, 82 | rawContent: tmpResult.rawContent, 83 | type: tmpResult.type, 84 | ); 85 | } 86 | 87 | /// Returns the number of cameras which are available 88 | /// Use n-1 as the index of the camera which should be used. 89 | static Future get numberOfCameras { 90 | return _channel.invokeMethod('numberOfCameras'); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/ActivityHelper.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import android.Manifest 4 | import android.app.Activity 5 | import android.content.Context 6 | import android.content.Intent 7 | import android.content.pm.PackageManager 8 | import android.util.Log 9 | import androidx.core.app.ActivityCompat 10 | import androidx.core.content.ContextCompat 11 | import io.flutter.plugin.common.EventChannel 12 | import io.flutter.plugin.common.MethodChannel 13 | import io.flutter.plugin.common.PluginRegistry.ActivityResultListener 14 | import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener 15 | 16 | class ActivityHelper(private var applicationContext: Context?, 17 | var activity: Activity? = null 18 | ) : ActivityResultListener, RequestPermissionsResultListener { 19 | 20 | companion object { 21 | const val TAG = "BarcodeScanPlugin" 22 | const val REQ_START_SCAN = 100 23 | const val REQ_CAMERA_PERMISSION = 200 24 | } 25 | 26 | private val activityResultMap: HashMap = linkedMapOf() 27 | private val permissionResultMap: HashMap = linkedMapOf() 28 | 29 | fun showScannerActivity(result: MethodChannel.Result, config: Protos.Configuration) { 30 | if (activity == null) { 31 | Log.d(TAG, "Could not launch BarcodeScannerActivity because the plugin is not attached to any activity") 32 | return 33 | } 34 | 35 | activityResultMap[REQ_START_SCAN] = ScanResultHandler(result) 36 | 37 | val intent = Intent(applicationContext, BarcodeScannerActivity::class.java) 38 | intent.putExtra(BarcodeScannerActivity.EXTRA_CONFIG, config.toByteArray()) 39 | activity!!.startActivityForResult(intent, REQ_START_SCAN) 40 | } 41 | 42 | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean { 43 | if (!activityResultMap.containsKey(requestCode)) { 44 | return false 45 | } 46 | 47 | return activityResultMap 48 | .getValue(requestCode) 49 | .onActivityResult(requestCode, resultCode, data) 50 | } 51 | 52 | fun requestCameraAccessIfNecessary(sink: EventChannel.EventSink? 53 | ): Boolean { 54 | if (activity == null) { 55 | Log.d(TAG, "Could not launch BarcodeScannerActivity because the plugin is not attached to any activity") 56 | return false 57 | } 58 | 59 | permissionResultMap[REQ_CAMERA_PERMISSION] = RequestCameraPermissionHandler(sink) 60 | 61 | val array = arrayOf(Manifest.permission.CAMERA) 62 | if (ContextCompat.checkSelfPermission(activity!!, Manifest.permission.CAMERA) 63 | == PackageManager.PERMISSION_GRANTED) { 64 | return false 65 | } 66 | 67 | ActivityCompat.requestPermissions(activity!!, array, REQ_CAMERA_PERMISSION) 68 | return true 69 | } 70 | 71 | override fun onRequestPermissionsResult(requestCode: Int, 72 | permissions: Array?, 73 | grantResults: IntArray? 74 | ): Boolean { 75 | if (!permissionResultMap.containsKey(requestCode)) { 76 | return false 77 | } 78 | 79 | return permissionResultMap 80 | .getValue(requestCode) 81 | .onRequestPermissionsResult(requestCode, permissions, grantResults) 82 | } 83 | } -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | generated_key_values = {} 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) do |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | generated_key_values[podname] = podpath 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | end 32 | generated_key_values 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | use_modular_headers! 38 | 39 | # Flutter Pod 40 | 41 | copied_flutter_dir = File.join(__dir__, 'Flutter') 42 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') 43 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') 44 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) 45 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. 46 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. 47 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. 48 | 49 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') 50 | unless File.exist?(generated_xcode_build_settings_path) 51 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" 52 | end 53 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) 54 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; 55 | 56 | unless File.exist?(copied_framework_path) 57 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) 58 | end 59 | unless File.exist?(copied_podspec_path) 60 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) 61 | end 62 | end 63 | 64 | # Keep pod path relative so it can be checked into Podfile.lock. 65 | pod 'Flutter', :path => 'Flutter' 66 | 67 | # Plugin Pods 68 | 69 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 70 | # referring to absolute paths on developers' machines. 71 | system('rm -rf .symlinks') 72 | system('mkdir -p .symlinks/plugins') 73 | plugin_pods = parse_KV_file('../.flutter-plugins') 74 | plugin_pods.each do |name, path| 75 | symlink = File.join('.symlinks', 'plugins', name) 76 | File.symlink(path, symlink) 77 | pod name, :path => File.join(symlink, 'ios') 78 | end 79 | end 80 | 81 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 82 | install! 'cocoapods', :disable_input_output_paths => true 83 | 84 | post_install do |installer| 85 | installer.pods_project.targets.each do |target| 86 | target.build_configurations.each do |config| 87 | config.build_settings['ENABLE_BITCODE'] = 'NO' 88 | end 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v3.0.1 - 2020-05-08 2 | 3 | Features: 4 | - [Added cancel for ux](https://github.com/mintware-de/flutter_barcode_reader/pull/198) - @iRaySpace 5 | 6 | Bugfixes: 7 | - [Fix autofocus crash](https://github.com/mintware-de/flutter_barcode_reader/pull/228) - @oznecniV97 8 | - [Fix camera selection in Android](https://github.com/mintware-de/flutter_barcode_reader/pull/231) - @GabrieleVolpato 9 | 10 | ## v3.0.0 - 2020-04-18 11 | 12 | Bugfixes: 13 | - [Add @Keep annotation](https://github.com/mintware-de/flutter_barcode_reader/pull/214) to fix "No implementation for method requestCameraPermission" - @devtronic 14 | 15 | ## v3.0.0-dev.3 - 2020-04-14 16 | 17 | Bugfixes: 18 | - [App crash on orientation change](https://github.com/mintware-de/flutter_barcode_reader/pull/209) - @subinsv 19 | 20 | ## v3.0.0-dev.2 - 2020-04-12 21 | 22 | Migrated the changes of the 2.0.0 track 23 | 24 | - Fixed the request camera permission flow on Android 25 | 26 | Updated also the Flutter env. SDK constraint to ">=2.1.0 <3.0.0" 27 | 28 | ## v3.0.0-dev.1 - 2020-04-12 29 | 30 | Changes: 31 | - [Rewrite platform communication](https://github.com/mintware-de/flutter_barcode_reader/pull/185) - @devtronic 32 | - This provides a better way to configure the plugin 33 | - iOS code migrated to Swift 34 | - Android code migrated to FlutterPlugin 35 | - Platform communication with protobuf 36 | - Retrieve the number of available cameras with `BarcodeScanner.numberOfCameras` 37 | - Flexible configuration: 38 | - Set the strings for the flash on/off and the cancel button 39 | - Restrict the detected barcode formats 40 | - Set which camera is used for scanning barcodes 41 | 42 | **BREAKING CHANGES**: 43 | - minSdk version on Android is now 18 44 | - `BarcodeScanner.scan()` returns a `ScanResult` object. Check [UPGRADE.md](./UPGRADE.md) for migration details. 45 | 46 | ## v2.0.2 - 2020-04-14 47 | 48 | Bugfixes: 49 | - [Fixed the request camera permission flow on Android](https://github.com/mintware-de/flutter_barcode_reader/pull/186) - @devtronic 50 | 51 | ## v2.0.1 - 2020-02-19 52 | 53 | Bugfixes: 54 | - Fixed wrong build.gradle 55 | 56 | ## v2.0.0 - 2020-02-19 57 | 58 | Features: 59 | - [Add-to-app support](https://github.com/mintware-de/flutter_barcode_reader/pull/168) - @santiihoyos 60 | - Changed overlay to full screen in iOS 13 61 | 62 | Bugfixes: 63 | - [Fixed rotation on iOS](https://github.com/mintware-de/flutter_barcode_reader/pull/167) - @mintware-de 64 | - [#61 Rotating orientation on iPhones only shows half the screen](https://github.com/mintware-de/flutter_barcode_reader/issues/61) 65 | 66 | Changes: 67 | - [Fix compile warning](https://github.com/mintware-de/flutter_barcode_reader/pull/127) - @lookfirst 68 | - [Upgrade gradle](https://github.com/mintware-de/flutter_barcode_reader/pull/142) - @SuuSoJeat 69 | - `com.android.tools.build:gradle`: 3.3.1 -> 3.5.0 70 | - `org.jetbrains.kotlin:kotlin-gradle-plugin`: 1.3.20 -> 1.3.50 71 | - `compileSdkVersion`: 28 -> 29 72 | - `targetSdkVersion`: 28 -> 29 73 | - `gradle`: 4.10.2 -> 5.4.1 74 | - [Package description updated](https://github.com/mintware-de/flutter_barcode_reader/pull/180) - @connectety 75 | - README.md and LICENSE.md updated 76 | - Since the project owner has been changed, the package names are different. Checkout the [UPGRADE.md](./UPGRADE.md) for details. 77 | 78 | ## v1.0.0 - 2018-08-30 79 | 80 | Breaking Change: Adds support for AndroidX 81 | 82 | ## v0.0.8 - 2018-08-30 83 | 84 | * Fixes [iOS: pressing cancel doesn't stop scanning](https://github.com/mintware-de/flutter_barcode_reader/issues/60) thanks to @tgezginis. 85 | 86 | ## v0.0.7 - 2018-08-30 87 | 88 | * Fix iOS barcodes not scanning 89 | 90 | ## v0.0.6 - 2018-08-29 91 | 92 | * Fix android dependencies 93 | * iOS scanner now looks like Android thanks to @dustin-graham 94 | 95 | ## v0.0.4 - 2018-02-8 96 | 97 | * Fix missing gradle dependency (thanks to [toteto](https://github.com/mintware-de/flutter_barcode_reader/pull/15)) 98 | * Update gradle dependencies 99 | 100 | ## v0.0.3 - 2017-02-8 101 | 102 | * Improved permission handling (thanks to [BenSower](https://github.com/BenSower)) 103 | * Added MIT license 104 | 105 | ## v0.0.2 - 2017-11-7 106 | 107 | * Rewrite iOS scanner in Objective-C to avoid Swift use_frameworks! conflicts with other plugins (see https://github.com/flutter/flutter/issues/10968) 108 | 109 | ## v0.0.1 - 2017-10-29 110 | 111 | * Supports 2D & QR Codes 112 | * Control flash while scanning 113 | -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/ChannelHandler.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import android.hardware.Camera 4 | import androidx.annotation.Keep 5 | import androidx.annotation.Nullable 6 | import io.flutter.plugin.common.BinaryMessenger 7 | import io.flutter.plugin.common.EventChannel 8 | import io.flutter.plugin.common.MethodCall 9 | import io.flutter.plugin.common.MethodChannel 10 | import java.lang.reflect.Method 11 | 12 | class ChannelHandler(private val activityHelper: ActivityHelper 13 | ) : MethodChannel.MethodCallHandler, EventChannel.StreamHandler { 14 | 15 | @Nullable 16 | private var methodChannel: MethodChannel? = null 17 | 18 | @Nullable 19 | private var eventChannel: EventChannel? = null 20 | 21 | @Nullable 22 | private var sink: EventChannel.EventSink? = null 23 | 24 | @Keep 25 | @Suppress("unused", "UNUSED_PARAMETER") 26 | fun scan(call: MethodCall, result: MethodChannel.Result) { 27 | var config: Protos.Configuration = Protos.Configuration.newBuilder() 28 | .putAllStrings(mapOf( 29 | "cancel" to "Cancel", 30 | "flash_on" to "Flash on", 31 | "flash_off" to "Flash off" 32 | )) 33 | .setAndroid(Protos.AndroidConfiguration 34 | .newBuilder() 35 | .setAspectTolerance(0.5) 36 | .setUseAutoFocus(true)) 37 | .addAllRestrictFormat(mutableListOf()) 38 | .setUseCamera(-1) 39 | .build() 40 | 41 | if (call.arguments is ByteArray) { 42 | config = Protos.Configuration.parseFrom(call.arguments as ByteArray) 43 | } 44 | activityHelper.showScannerActivity(result, config) 45 | } 46 | 47 | @Keep 48 | @Suppress("unused", "UNUSED_PARAMETER") 49 | fun numberOfCameras(call: MethodCall, result: MethodChannel.Result) { 50 | result.success(Camera.getNumberOfCameras()) 51 | } 52 | 53 | @Keep 54 | @Suppress("unused", "UNUSED_PARAMETER") 55 | fun requestCameraPermission(call: MethodCall, result: MethodChannel.Result) { 56 | result.success(activityHelper.requestCameraAccessIfNecessary(sink)) 57 | } 58 | 59 | fun startListening(messenger: BinaryMessenger?) { 60 | if (methodChannel != null) { 61 | stopListening() 62 | } 63 | 64 | methodChannel = MethodChannel(messenger, "de.mintware.barcode_scan").apply { 65 | setMethodCallHandler(this@ChannelHandler) 66 | } 67 | 68 | if (eventChannel != null) { 69 | stopListening() 70 | } 71 | 72 | eventChannel = EventChannel(messenger, "de.mintware.barcode_scan/events").apply { 73 | setStreamHandler(this@ChannelHandler) 74 | } 75 | } 76 | 77 | fun stopListening() { 78 | if (methodChannel != null) { 79 | methodChannel!!.setMethodCallHandler(null) 80 | methodChannel = null 81 | } 82 | 83 | if (eventChannel != null) { 84 | eventChannel!!.setStreamHandler(null) 85 | eventChannel = null 86 | } 87 | } 88 | 89 | // region MethodCallHandler 90 | 91 | // This map holds all available methods in this class 92 | private val methodMap = HashMap() 93 | 94 | // Handles the method call and calls the correct method in this class 95 | override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { 96 | if (methodMap.isEmpty()) { 97 | fetchMethods() 98 | } 99 | 100 | val method = methodMap[call.method] 101 | if (null == method) { 102 | result.notImplemented() 103 | return 104 | } 105 | 106 | val args = arrayOfNulls(2) 107 | args[0] = call 108 | args[1] = result 109 | 110 | try { 111 | method.invoke(this, *args) 112 | } catch (e: Exception) { 113 | result.error(call.method, e.message, e) 114 | } 115 | 116 | } 117 | 118 | // Fetches all methods in this class 119 | private fun fetchMethods() { 120 | val c = this::class.java 121 | val m = c.declaredMethods 122 | 123 | for (method in m) { 124 | methodMap[method.name] = method 125 | } 126 | } 127 | // endregion 128 | 129 | // region StreamHandler 130 | 131 | override fun onListen(arguments: Any?, events: EventChannel.EventSink?) { 132 | sink = events 133 | } 134 | 135 | override fun onCancel(arguments: Any?) { 136 | sink = null 137 | } 138 | // endregion 139 | } 140 | -------------------------------------------------------------------------------- /ios/Classes/ScannerOverlay.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScannerOverlay.swift 3 | // barcode_scan 4 | // 5 | // Created by Julian Finkler on 20.02.20. 6 | // 7 | 8 | import Foundation 9 | 10 | class ScannerOverlay: UIView { 11 | private let line: UIView = UIView() 12 | 13 | private var scanLineRect: CGRect { 14 | let scanRect = calculateScanRect() 15 | let positionY = scanRect.origin.y + (scanRect.size.height / 2) 16 | 17 | return CGRect(x: scanRect.origin.x, 18 | y: positionY, 19 | width: scanRect.size.width, 20 | height: 1 21 | ) 22 | } 23 | 24 | override init(frame: CGRect) { 25 | super.init(frame: frame) 26 | line.backgroundColor = UIColor.red 27 | line.translatesAutoresizingMaskIntoConstraints = false 28 | 29 | addSubview(line) 30 | } 31 | 32 | required init?(coder: NSCoder) { 33 | super.init(coder: coder) 34 | } 35 | 36 | override func draw(_ rect: CGRect) { 37 | let context = UIGraphicsGetCurrentContext() 38 | 39 | let overlayColor = UIColor(red: 0.0, 40 | green: 0.0, 41 | blue: 0.0, 42 | alpha: 0.55 43 | ) 44 | 45 | context?.setFillColor(overlayColor.cgColor) 46 | context?.fill(bounds) 47 | 48 | // make a hole for the scanner 49 | let holeRect = calculateScanRect() 50 | let holeRectIntersection = holeRect.intersection(rect) 51 | UIColor.clear.setFill() 52 | UIRectFill(holeRectIntersection) 53 | 54 | // draw a horizontal line over the middle 55 | let lineRect = scanLineRect 56 | line.frame = lineRect 57 | 58 | // draw the green corners 59 | let cornerSize: CGFloat = 30 60 | let path = UIBezierPath() 61 | 62 | //top left corner 63 | path.move(to: CGPoint(x: holeRect.origin.x, y: holeRect.origin.y + cornerSize)) 64 | path.addLine(to: CGPoint(x: holeRect.origin.x, y: holeRect.origin.y)) 65 | path.addLine(to: CGPoint(x: holeRect.origin.x + cornerSize, y: holeRect.origin.y)) 66 | 67 | //top right corner 68 | let rightHoleX = holeRect.origin.x + holeRect.size.width 69 | path.move(to: CGPoint(x: rightHoleX - cornerSize, y: holeRect.origin.y)) 70 | path.addLine(to: CGPoint(x: rightHoleX, y: holeRect.origin.y)) 71 | path.addLine(to: CGPoint(x: rightHoleX, y: holeRect.origin.y + cornerSize)) 72 | 73 | // bottom right corner 74 | let bottomHoleY = holeRect.origin.y + holeRect.size.height 75 | path.move(to: CGPoint(x: rightHoleX, y: bottomHoleY - cornerSize)) 76 | path.addLine(to: CGPoint(x: rightHoleX, y: bottomHoleY)) 77 | path.addLine(to: CGPoint(x: rightHoleX - cornerSize, y: bottomHoleY)) 78 | 79 | // bottom left corner 80 | path.move(to: CGPoint(x: holeRect.origin.x + cornerSize, y: bottomHoleY)) 81 | path.addLine(to: CGPoint(x: holeRect.origin.x, y: bottomHoleY)) 82 | path.addLine(to: CGPoint(x: holeRect.origin.x, y: bottomHoleY - cornerSize)) 83 | 84 | path.lineWidth = 2 85 | UIColor.green.setStroke() 86 | path.stroke() 87 | } 88 | 89 | public func startAnimating() { 90 | layer.removeAnimation(forKey: "flashAnimation") 91 | let flash = CABasicAnimation(keyPath: "opacity") 92 | flash.fromValue = NSNumber(value: 0.0) 93 | flash.toValue = NSNumber(value: 1.0) 94 | flash.duration = 0.25 95 | flash.autoreverses = true 96 | flash.repeatCount = HUGE 97 | line.layer.add(flash, forKey: "flashAnimation") 98 | } 99 | 100 | public func stopAnimating() { 101 | layer.removeAnimation(forKey: "flashAnimation") 102 | } 103 | 104 | private func calculateScanRect() -> CGRect { 105 | let rect = frame 106 | 107 | let frameWidth = rect.size.width 108 | var frameHeight = rect.size.height 109 | 110 | let isLandscape = frameWidth > frameHeight 111 | let widthOnPortrait = isLandscape ? frameHeight : frameWidth 112 | let scanRectWidth = widthOnPortrait * 0.8 113 | let aspectRatio: CGFloat = 3.0 / 4.0 114 | let scanRectHeight = scanRectWidth * aspectRatio 115 | 116 | if isLandscape { 117 | let navbarHeight: CGFloat = 32 118 | frameHeight += navbarHeight 119 | } 120 | 121 | let scanRectOriginX = (frameWidth - scanRectWidth) / 2 122 | let scanRectOriginY = (frameHeight - scanRectHeight) / 2 123 | return CGRect(x: scanRectOriginX, 124 | y: scanRectOriginY, 125 | width: scanRectWidth, 126 | height: scanRectHeight 127 | ) 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScannerActivity.kt: -------------------------------------------------------------------------------- 1 | package de.mintware.barcode_scan 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import android.view.Menu 7 | import android.view.MenuItem 8 | import com.google.zxing.BarcodeFormat 9 | import com.google.zxing.Result 10 | import me.dm7.barcodescanner.zxing.ZXingScannerView 11 | 12 | class BarcodeScannerActivity : Activity(), ZXingScannerView.ResultHandler { 13 | 14 | init { 15 | title = "" 16 | } 17 | 18 | private lateinit var config: Protos.Configuration 19 | private var scannerView: ZXingScannerView? = null 20 | 21 | companion object { 22 | const val TOGGLE_FLASH = 200 23 | const val CANCEL = 300 24 | const val EXTRA_CONFIG = "config" 25 | const val EXTRA_RESULT = "scan_result" 26 | const val EXTRA_ERROR_CODE = "error_code" 27 | 28 | private val formatMap: Map = mapOf( 29 | Protos.BarcodeFormat.aztec to BarcodeFormat.AZTEC, 30 | Protos.BarcodeFormat.code39 to BarcodeFormat.CODE_39, 31 | Protos.BarcodeFormat.code93 to BarcodeFormat.CODE_93, 32 | Protos.BarcodeFormat.code128 to BarcodeFormat.CODE_128, 33 | Protos.BarcodeFormat.dataMatrix to BarcodeFormat.DATA_MATRIX, 34 | Protos.BarcodeFormat.ean8 to BarcodeFormat.EAN_8, 35 | Protos.BarcodeFormat.ean13 to BarcodeFormat.EAN_13, 36 | Protos.BarcodeFormat.interleaved2of5 to BarcodeFormat.ITF, 37 | Protos.BarcodeFormat.pdf417 to BarcodeFormat.PDF_417, 38 | Protos.BarcodeFormat.qr to BarcodeFormat.QR_CODE, 39 | Protos.BarcodeFormat.upce to BarcodeFormat.UPC_E 40 | ) 41 | 42 | } 43 | 44 | // region Activity lifecycle 45 | override fun onCreate(savedInstanceState: Bundle?) { 46 | super.onCreate(savedInstanceState) 47 | 48 | config = Protos.Configuration.parseFrom(intent.extras!!.getByteArray(EXTRA_CONFIG)) 49 | } 50 | 51 | private fun setupScannerView() { 52 | if (scannerView != null) { 53 | return 54 | } 55 | 56 | scannerView = ZXingAutofocusScannerView(this).apply { 57 | setAutoFocus(config.android.useAutoFocus) 58 | val restrictedFormats = mapRestrictedBarcodeTypes() 59 | if (restrictedFormats.isNotEmpty()) { 60 | setFormats(restrictedFormats) 61 | } 62 | 63 | // this parameter will make your HUAWEI phone works great! 64 | setAspectTolerance(config.android.aspectTolerance.toFloat()) 65 | if (config.autoEnableFlash) { 66 | flash = config.autoEnableFlash 67 | invalidateOptionsMenu() 68 | } 69 | } 70 | 71 | setContentView(scannerView) 72 | } 73 | 74 | // region AppBar menu 75 | override fun onCreateOptionsMenu(menu: Menu): Boolean { 76 | var buttonText = config.stringsMap["flash_on"] 77 | if (scannerView?.flash == true) { 78 | buttonText = config.stringsMap["flash_off"] 79 | } 80 | val flashButton = menu.add(0, TOGGLE_FLASH, 0, buttonText) 81 | flashButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS) 82 | 83 | val cancelButton = menu.add(0, CANCEL, 0, config.stringsMap["cancel"]) 84 | cancelButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS) 85 | 86 | return super.onCreateOptionsMenu(menu) 87 | } 88 | 89 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 90 | if (item.itemId == TOGGLE_FLASH) { 91 | scannerView?.toggleFlash() 92 | this.invalidateOptionsMenu() 93 | return true 94 | } 95 | if (item.itemId == CANCEL) { 96 | setResult(RESULT_CANCELED) 97 | finish() 98 | return true 99 | } 100 | return super.onOptionsItemSelected(item) 101 | } 102 | 103 | override fun onPause() { 104 | super.onPause() 105 | scannerView?.stopCamera() 106 | } 107 | 108 | override fun onResume() { 109 | super.onResume() 110 | setupScannerView() 111 | scannerView?.setResultHandler(this) 112 | if (config.useCamera > -1) { 113 | scannerView?.startCamera(config.useCamera) 114 | } else { 115 | scannerView?.startCamera() 116 | } 117 | } 118 | // endregion 119 | 120 | override fun handleResult(result: Result?) { 121 | val intent = Intent() 122 | 123 | val builder = Protos.ScanResult.newBuilder() 124 | if (result == null) { 125 | 126 | builder.let { 127 | it.format = Protos.BarcodeFormat.unknown 128 | it.rawContent = "No data was scanned" 129 | it.type = Protos.ResultType.Error 130 | } 131 | } else { 132 | 133 | val format = (formatMap.filterValues { it == result.barcodeFormat }.keys.firstOrNull() 134 | ?: Protos.BarcodeFormat.unknown) 135 | 136 | var formatNote = "" 137 | if (format == Protos.BarcodeFormat.unknown) { 138 | formatNote = result.barcodeFormat.toString() 139 | } 140 | 141 | builder.let { 142 | it.format = format 143 | it.formatNote = formatNote 144 | it.rawContent = result.text 145 | it.type = Protos.ResultType.Barcode 146 | } 147 | } 148 | val res = builder.build() 149 | intent.putExtra(EXTRA_RESULT, res.toByteArray()) 150 | setResult(RESULT_OK, intent) 151 | finish() 152 | } 153 | 154 | private fun mapRestrictedBarcodeTypes(): List { 155 | val types: MutableList = mutableListOf() 156 | 157 | this.config.restrictFormatList.filterNotNull().forEach { 158 | if (!formatMap.containsKey(it)) { 159 | print("Unrecognized") 160 | return@forEach 161 | } 162 | 163 | types.add(formatMap.getValue(it)) 164 | } 165 | 166 | return types 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub license](https://img.shields.io/github/license/mintware-de/flutter_barcode_reader.svg)](https://github.com/mintware-de/flutter_barcode_reader/blob/master/LICENSE) 2 | [![GitHub stars](https://img.shields.io/github/stars/mintware-de/flutter_barcode_reader)](https://github.com/mintware-de/flutter_barcode_reader/stargazers) 3 | [![Pub](https://img.shields.io/pub/v/barcode_scan.svg)](https://pub.dartlang.org/packages/barcode_scan) 4 | [![GitHub forks](https://img.shields.io/github/forks/mintware-de/flutter_barcode_reader)](https://github.com/mintware-de/flutter_barcode_reader/network) 5 | 6 | # DEVELOPMENT HAS BEEN DISCONTINUED 7 | Since there are many other libraries which provides more and better functionality in barcode scanning, I decided to discontinue the development of this project. 8 | I recommend the Firebase ML Vision package as an alternative: https://pub.dev/packages/firebase_ml_vision 9 | 10 |








11 |








12 | 13 | # Barcode Scanner 14 | 15 | A flutter plugin for scanning 2D barcodes and QR codes. 16 | 17 | This provides a simple wrapper for two commonly used iOS and Android libraries: 18 | 19 | iOS: https://github.com/mikebuss/MTBBarcodeScanner 20 | 21 | Android: https://github.com/dm77/barcodescanner 22 | 23 | ### Features 24 | - [x] Scan 2D barcodes 25 | - [x] Scan QR codes 26 | - [x] Control the flash while scanning 27 | - [x] Permission handling 28 | 29 | ## Getting Started 30 | 31 | ### Android 32 | For Android, you must do the following before you can use the plugin: 33 | 34 | * Add the camera permission to your AndroidManifest.xml 35 | 36 | `` 37 | 38 | * This plugin is written in Kotlin. Therefore, you need to add Kotlin support to your project. See [installing the Kotlin plugin](https://kotlinlang.org/docs/tutorials/kotlin-android.html#installing-the-kotlin-plugin). 39 | 40 | Edit your project-level build.gradle file to look like this: 41 | ```groovy 42 | buildscript { 43 | ext.kotlin_version = '1.3.61' 44 | // ... 45 | dependencies { 46 | // ... 47 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 48 | } 49 | } 50 | // ... 51 | ``` 52 | 53 | Edit your app-level build.gradle file to look like this: 54 | 55 | ```groovy 56 | apply plugin: 'kotlin-android' 57 | // ... 58 | dependencies { 59 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 60 | // ... 61 | } 62 | ``` 63 | 64 | Now you can depend on the barcode_scan plugin in your pubspec.yaml file: 65 | 66 | ```yaml 67 | dependencies: 68 | # ... 69 | barcode_scan: any 70 | ``` 71 | Click "Packages get" in Android Studio or run `flutter packages get` in your project folder. 72 | 73 | ### iOS 74 | To use on iOS, you must add the the camera usage description to your Info.plist 75 | 76 | ```xml 77 | 78 | 79 | NSCameraUsageDescription 80 | Camera permission is required for barcode scanning. 81 | 82 | 83 | ``` 84 | 85 | 86 | ## Usage 87 | 88 | ```dart 89 | 90 | import 'package:barcode_scan/barcode_scan.dart'; 91 | 92 | void main() async { 93 | var result = await BarcodeScanner.scan(); 94 | 95 | print(result.type); // The result type (barcode, cancelled, failed) 96 | print(result.rawContent); // The barcode content 97 | print(result.format); // The barcode format (as enum) 98 | print(result.formatNote); // If a unknown format was scanned this field contains a note 99 | } 100 | ``` 101 | 102 | 103 | ## Advanced usage 104 | You can pass options to the scan method: 105 | 106 | ```dart 107 | 108 | import 'package:barcode_scan/barcode_scan.dart'; 109 | 110 | void main() async { 111 | 112 | var options = ScanOptions( 113 | // set the options 114 | ); 115 | 116 | var result = await BarcodeScanner.scan(options: options); 117 | 118 | // ... 119 | } 120 | ``` 121 | 122 | ### Supported options 123 | | Option | Type | Description | Supported by | 124 | |----------------------------|-------------------|-------------------------------------------------------------------------------------------|---------------| 125 | | `strings.cancel` | `String` | The cancel button text on iOS | iOS only | 126 | | `strings.flash_on` | `String` | The flash on button text | iOS + Android | 127 | | `strings.flash_off` | `String` | The flash off button text | iOS + Android | 128 | | `restrictFormat` | `BarcodeFormat[]` | Restrict the formats which are recognized | iOS + Android | 129 | | `useCamera` | `int` | The index of the camera which is used for scanning (See `BarcodeScanner.numberOfCameras`) | iOS + Android | 130 | | `autoEnableFlash` | `bool` | Enable the flash when start scanning | iOS + Android | 131 | | `android.aspectTolerance` | `double` | Enable auto focus on Android | Android only | 132 | | `android.useAutoFocus` | `bool` | Set aspect ratio tolerance level used in calculating the optimal Camera preview size | Android only | 133 | 134 | ## Development setup 135 | 136 | ### Setup protobuf 137 | 138 | Mac: 139 | ```bash 140 | $ brew install protobuf 141 | $ brew install swift-protobuf 142 | ``` 143 | Windows / Linux: https://github.com/protocolbuffers/protobuf#protocol-compiler-installation 144 | 145 | 146 | Activate the protobuf dart plugin: 147 | `$ pub global activate protoc_plugin` 148 | 149 | Install the`Protobuf Support` plugin for IDEA / Android Studio or `vscode-proto3` for VS Code 150 | 151 | If you changed the protos.proto you've to execute the ./generate_proto.sh to update the dart / swift sources 152 | 153 | 154 | 155 | 156 | 157 | 158 | ## Common problems 159 | ### Android "Could not find org.jetbrains.kotlin:kotlin-stdlib-jre..." 160 | Change `org.jetbrains.kotlin:kotlin-stdlib-jre` to `org.jetbrains.kotlin:kotlin-stdlib-jdk` 161 | ([StackOverflow](https://stackoverflow.com/a/53358817)) 162 | -------------------------------------------------------------------------------- /ios/Classes/BarcodeScannerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarcodeScannerViewController.swift 3 | // barcode_scan 4 | // 5 | // Created by Julian Finkler on 20.02.20. 6 | // 7 | 8 | import Foundation 9 | import MTBBarcodeScanner 10 | 11 | class BarcodeScannerViewController: UIViewController { 12 | private var previewView: UIView? 13 | private var scanRect: ScannerOverlay? 14 | private var scanner: MTBBarcodeScanner? 15 | 16 | var config: Configuration = Configuration.with { 17 | $0.strings = [ 18 | "cancel" : "Cancel", 19 | "flash_on" : "Flash on", 20 | "flash_off" : "Flash off", 21 | ] 22 | $0.useCamera = -1 // Default camera 23 | $0.autoEnableFlash = false 24 | } 25 | 26 | private let formatMap = [ 27 | BarcodeFormat.aztec : AVMetadataObject.ObjectType.aztec, 28 | BarcodeFormat.code39 : AVMetadataObject.ObjectType.code39, 29 | BarcodeFormat.code93 : AVMetadataObject.ObjectType.code93, 30 | BarcodeFormat.code128 : AVMetadataObject.ObjectType.code128, 31 | BarcodeFormat.dataMatrix : AVMetadataObject.ObjectType.dataMatrix, 32 | BarcodeFormat.ean8 : AVMetadataObject.ObjectType.ean8, 33 | BarcodeFormat.ean13 : AVMetadataObject.ObjectType.ean13, 34 | BarcodeFormat.interleaved2Of5 : AVMetadataObject.ObjectType.interleaved2of5, 35 | BarcodeFormat.pdf417 : AVMetadataObject.ObjectType.pdf417, 36 | BarcodeFormat.qr : AVMetadataObject.ObjectType.qr, 37 | BarcodeFormat.upce : AVMetadataObject.ObjectType.upce, 38 | ] 39 | 40 | var delegate: BarcodeScannerViewControllerDelegate? 41 | 42 | private var device: AVCaptureDevice? { 43 | return AVCaptureDevice.default(for: .video) 44 | } 45 | 46 | private var isFlashOn: Bool { 47 | return device != nil && (device?.flashMode == AVCaptureDevice.FlashMode.on || device?.torchMode == .on) 48 | } 49 | 50 | private var hasTorch: Bool { 51 | return device?.hasTorch ?? false 52 | } 53 | 54 | override func viewDidLoad() { 55 | super.viewDidLoad() 56 | 57 | #if targetEnvironment(simulator) 58 | view.backgroundColor = .lightGray 59 | #endif 60 | 61 | previewView = UIView(frame: view.bounds) 62 | if let previewView = previewView { 63 | previewView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 64 | view.addSubview(previewView) 65 | } 66 | setupScanRect(view.bounds) 67 | 68 | let restrictedBarcodeTypes = mapRestrictedBarcodeTypes() 69 | if restrictedBarcodeTypes.isEmpty { 70 | scanner = MTBBarcodeScanner(previewView: previewView) 71 | } else { 72 | scanner = MTBBarcodeScanner(metadataObjectTypes: restrictedBarcodeTypes, 73 | previewView: previewView 74 | ) 75 | } 76 | navigationItem.leftBarButtonItem = UIBarButtonItem(title: config.strings["cancel"], 77 | style: .plain, 78 | target: self, 79 | action: #selector(cancel) 80 | ) 81 | updateToggleFlashButton() 82 | } 83 | 84 | override func viewDidAppear(_ animated: Bool) { 85 | super.viewDidAppear(animated) 86 | 87 | if scanner!.isScanning() { 88 | scanner!.stopScanning() 89 | } 90 | 91 | scanRect?.startAnimating() 92 | MTBBarcodeScanner.requestCameraPermission(success: { success in 93 | if success { 94 | self.startScan() 95 | } else { 96 | #if !targetEnvironment(simulator) 97 | self.errorResult(errorCode: "PERMISSION_NOT_GRANTED") 98 | #endif 99 | } 100 | }) 101 | } 102 | 103 | override func viewWillDisappear(_ animated: Bool) { 104 | scanner?.stopScanning() 105 | scanRect?.stopAnimating() 106 | 107 | if isFlashOn { 108 | setFlashState(false) 109 | } 110 | 111 | super.viewWillDisappear(animated) 112 | } 113 | 114 | override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { 115 | super.viewWillTransition(to: size, with: coordinator) 116 | setupScanRect(CGRect(origin: CGPoint(x: 0, y:0), 117 | size: size 118 | )) 119 | } 120 | 121 | private func setupScanRect(_ bounds: CGRect) { 122 | if scanRect != nil { 123 | scanRect?.stopAnimating() 124 | scanRect?.removeFromSuperview() 125 | } 126 | scanRect = ScannerOverlay(frame: bounds) 127 | if let scanRect = scanRect { 128 | scanRect.translatesAutoresizingMaskIntoConstraints = false 129 | scanRect.backgroundColor = UIColor.clear 130 | view.addSubview(scanRect) 131 | scanRect.startAnimating() 132 | } 133 | } 134 | 135 | private func startScan() { 136 | do { 137 | try scanner!.startScanning(with: cameraFromConfig, resultBlock: { codes in 138 | if let code = codes?.first { 139 | let codeType = self.formatMap.first(where: { $0.value == code.type }); 140 | let scanResult = ScanResult.with { 141 | $0.type = .barcode 142 | $0.rawContent = code.stringValue ?? "" 143 | $0.format = codeType?.key ?? .unknown 144 | $0.formatNote = codeType == nil ? code.type.rawValue : "" 145 | } 146 | self.scanner!.stopScanning() 147 | self.scanResult(scanResult) 148 | } 149 | }) 150 | if(config.autoEnableFlash){ 151 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { 152 | self.setFlashState(true) 153 | } 154 | } 155 | } catch { 156 | self.scanResult(ScanResult.with { 157 | $0.type = .error 158 | $0.rawContent = "\(error)" 159 | $0.format = .unknown 160 | }) 161 | } 162 | } 163 | 164 | @objc private func cancel() { 165 | scanResult( ScanResult.with { 166 | $0.type = .cancelled 167 | $0.format = .unknown 168 | }); 169 | } 170 | 171 | @objc private func onToggleFlash() { 172 | setFlashState(!isFlashOn) 173 | } 174 | 175 | private func updateToggleFlashButton() { 176 | if !hasTorch { 177 | return 178 | } 179 | 180 | let buttonText = isFlashOn ? config.strings["flash_off"] : config.strings["flash_on"] 181 | navigationItem.rightBarButtonItem = UIBarButtonItem(title: buttonText, 182 | style: .plain, 183 | target: self, 184 | action: #selector(onToggleFlash) 185 | ) 186 | } 187 | 188 | private func setFlashState(_ on: Bool) { 189 | if let device = device { 190 | guard device.hasFlash && device.hasTorch else { 191 | return 192 | } 193 | 194 | do { 195 | try device.lockForConfiguration() 196 | } catch { 197 | return 198 | } 199 | 200 | device.flashMode = on ? .on : .off 201 | device.torchMode = on ? .on : .off 202 | 203 | device.unlockForConfiguration() 204 | updateToggleFlashButton() 205 | } 206 | } 207 | 208 | private func errorResult(errorCode: String){ 209 | delegate?.didFailWithErrorCode(self, errorCode: errorCode) 210 | dismiss(animated: false) 211 | } 212 | 213 | private func scanResult(_ scanResult: ScanResult){ 214 | self.delegate?.didScanBarcodeWithResult(self, scanResult: scanResult) 215 | dismiss(animated: false) 216 | } 217 | 218 | private func mapRestrictedBarcodeTypes() -> [String] { 219 | var types: [AVMetadataObject.ObjectType] = [] 220 | 221 | config.restrictFormat.forEach({ format in 222 | if let mappedFormat = formatMap[format]{ 223 | types.append(mappedFormat) 224 | } 225 | }) 226 | 227 | return types.map({ t in t.rawValue}) 228 | } 229 | 230 | private var cameraFromConfig: MTBCamera { 231 | return config.useCamera == 1 ? .front : .back 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /lib/gen/protos/protos.pb.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: protos/protos.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | import 'dart:core' as $core; 9 | 10 | import 'package:protobuf/protobuf.dart' as $pb; 11 | 12 | import 'protos.pbenum.dart'; 13 | 14 | export 'protos.pbenum.dart'; 15 | 16 | class AndroidConfiguration extends $pb.GeneratedMessage { 17 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('AndroidConfiguration', createEmptyInstance: create) 18 | ..a<$core.double>(1, 'aspectTolerance', $pb.PbFieldType.OD, protoName: 'aspectTolerance') 19 | ..aOB(2, 'useAutoFocus', protoName: 'useAutoFocus') 20 | ..hasRequiredFields = false 21 | ; 22 | 23 | AndroidConfiguration._() : super(); 24 | factory AndroidConfiguration() => create(); 25 | factory AndroidConfiguration.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 26 | factory AndroidConfiguration.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 27 | AndroidConfiguration clone() => AndroidConfiguration()..mergeFromMessage(this); 28 | AndroidConfiguration copyWith(void Function(AndroidConfiguration) updates) => super.copyWith((message) => updates(message as AndroidConfiguration)); 29 | $pb.BuilderInfo get info_ => _i; 30 | @$core.pragma('dart2js:noInline') 31 | static AndroidConfiguration create() => AndroidConfiguration._(); 32 | AndroidConfiguration createEmptyInstance() => create(); 33 | static $pb.PbList createRepeated() => $pb.PbList(); 34 | @$core.pragma('dart2js:noInline') 35 | static AndroidConfiguration getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 36 | static AndroidConfiguration _defaultInstance; 37 | 38 | @$pb.TagNumber(1) 39 | $core.double get aspectTolerance => $_getN(0); 40 | @$pb.TagNumber(1) 41 | set aspectTolerance($core.double v) { $_setDouble(0, v); } 42 | @$pb.TagNumber(1) 43 | $core.bool hasAspectTolerance() => $_has(0); 44 | @$pb.TagNumber(1) 45 | void clearAspectTolerance() => clearField(1); 46 | 47 | @$pb.TagNumber(2) 48 | $core.bool get useAutoFocus => $_getBF(1); 49 | @$pb.TagNumber(2) 50 | set useAutoFocus($core.bool v) { $_setBool(1, v); } 51 | @$pb.TagNumber(2) 52 | $core.bool hasUseAutoFocus() => $_has(1); 53 | @$pb.TagNumber(2) 54 | void clearUseAutoFocus() => clearField(2); 55 | } 56 | 57 | class Configuration extends $pb.GeneratedMessage { 58 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('Configuration', createEmptyInstance: create) 59 | ..m<$core.String, $core.String>(1, 'strings', entryClassName: 'Configuration.StringsEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS) 60 | ..pc(2, 'restrictFormat', $pb.PbFieldType.PE, protoName: 'restrictFormat', valueOf: BarcodeFormat.valueOf, enumValues: BarcodeFormat.values) 61 | ..a<$core.int>(3, 'useCamera', $pb.PbFieldType.O3, protoName: 'useCamera') 62 | ..aOM(4, 'android', subBuilder: AndroidConfiguration.create) 63 | ..aOB(5, 'autoEnableFlash', protoName: 'autoEnableFlash') 64 | ..hasRequiredFields = false 65 | ; 66 | 67 | Configuration._() : super(); 68 | factory Configuration() => create(); 69 | factory Configuration.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 70 | factory Configuration.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 71 | Configuration clone() => Configuration()..mergeFromMessage(this); 72 | Configuration copyWith(void Function(Configuration) updates) => super.copyWith((message) => updates(message as Configuration)); 73 | $pb.BuilderInfo get info_ => _i; 74 | @$core.pragma('dart2js:noInline') 75 | static Configuration create() => Configuration._(); 76 | Configuration createEmptyInstance() => create(); 77 | static $pb.PbList createRepeated() => $pb.PbList(); 78 | @$core.pragma('dart2js:noInline') 79 | static Configuration getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 80 | static Configuration _defaultInstance; 81 | 82 | @$pb.TagNumber(1) 83 | $core.Map<$core.String, $core.String> get strings => $_getMap(0); 84 | 85 | @$pb.TagNumber(2) 86 | $core.List get restrictFormat => $_getList(1); 87 | 88 | @$pb.TagNumber(3) 89 | $core.int get useCamera => $_getIZ(2); 90 | @$pb.TagNumber(3) 91 | set useCamera($core.int v) { $_setSignedInt32(2, v); } 92 | @$pb.TagNumber(3) 93 | $core.bool hasUseCamera() => $_has(2); 94 | @$pb.TagNumber(3) 95 | void clearUseCamera() => clearField(3); 96 | 97 | @$pb.TagNumber(4) 98 | AndroidConfiguration get android => $_getN(3); 99 | @$pb.TagNumber(4) 100 | set android(AndroidConfiguration v) { setField(4, v); } 101 | @$pb.TagNumber(4) 102 | $core.bool hasAndroid() => $_has(3); 103 | @$pb.TagNumber(4) 104 | void clearAndroid() => clearField(4); 105 | @$pb.TagNumber(4) 106 | AndroidConfiguration ensureAndroid() => $_ensure(3); 107 | 108 | @$pb.TagNumber(5) 109 | $core.bool get autoEnableFlash => $_getBF(4); 110 | @$pb.TagNumber(5) 111 | set autoEnableFlash($core.bool v) { $_setBool(4, v); } 112 | @$pb.TagNumber(5) 113 | $core.bool hasAutoEnableFlash() => $_has(4); 114 | @$pb.TagNumber(5) 115 | void clearAutoEnableFlash() => clearField(5); 116 | } 117 | 118 | class ScanResult extends $pb.GeneratedMessage { 119 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('ScanResult', createEmptyInstance: create) 120 | ..e(1, 'type', $pb.PbFieldType.OE, defaultOrMaker: ResultType.Barcode, valueOf: ResultType.valueOf, enumValues: ResultType.values) 121 | ..aOS(2, 'rawContent', protoName: 'rawContent') 122 | ..e(3, 'format', $pb.PbFieldType.OE, defaultOrMaker: BarcodeFormat.unknown, valueOf: BarcodeFormat.valueOf, enumValues: BarcodeFormat.values) 123 | ..aOS(4, 'formatNote', protoName: 'formatNote') 124 | ..hasRequiredFields = false 125 | ; 126 | 127 | ScanResult._() : super(); 128 | factory ScanResult() => create(); 129 | factory ScanResult.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 130 | factory ScanResult.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 131 | ScanResult clone() => ScanResult()..mergeFromMessage(this); 132 | ScanResult copyWith(void Function(ScanResult) updates) => super.copyWith((message) => updates(message as ScanResult)); 133 | $pb.BuilderInfo get info_ => _i; 134 | @$core.pragma('dart2js:noInline') 135 | static ScanResult create() => ScanResult._(); 136 | ScanResult createEmptyInstance() => create(); 137 | static $pb.PbList createRepeated() => $pb.PbList(); 138 | @$core.pragma('dart2js:noInline') 139 | static ScanResult getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 140 | static ScanResult _defaultInstance; 141 | 142 | @$pb.TagNumber(1) 143 | ResultType get type => $_getN(0); 144 | @$pb.TagNumber(1) 145 | set type(ResultType v) { setField(1, v); } 146 | @$pb.TagNumber(1) 147 | $core.bool hasType() => $_has(0); 148 | @$pb.TagNumber(1) 149 | void clearType() => clearField(1); 150 | 151 | @$pb.TagNumber(2) 152 | $core.String get rawContent => $_getSZ(1); 153 | @$pb.TagNumber(2) 154 | set rawContent($core.String v) { $_setString(1, v); } 155 | @$pb.TagNumber(2) 156 | $core.bool hasRawContent() => $_has(1); 157 | @$pb.TagNumber(2) 158 | void clearRawContent() => clearField(2); 159 | 160 | @$pb.TagNumber(3) 161 | BarcodeFormat get format => $_getN(2); 162 | @$pb.TagNumber(3) 163 | set format(BarcodeFormat v) { setField(3, v); } 164 | @$pb.TagNumber(3) 165 | $core.bool hasFormat() => $_has(2); 166 | @$pb.TagNumber(3) 167 | void clearFormat() => clearField(3); 168 | 169 | @$pb.TagNumber(4) 170 | $core.String get formatNote => $_getSZ(3); 171 | @$pb.TagNumber(4) 172 | set formatNote($core.String v) { $_setString(3, v); } 173 | @$pb.TagNumber(4) 174 | $core.bool hasFormatNote() => $_has(3); 175 | @$pb.TagNumber(4) 176 | void clearFormatNote() => clearField(4); 177 | } 178 | 179 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io' show Platform; 3 | 4 | import 'package:barcode_scan/barcode_scan.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | 8 | void main() { 9 | runApp(_MyApp()); 10 | } 11 | 12 | class _MyApp extends StatefulWidget { 13 | @override 14 | _MyAppState createState() => _MyAppState(); 15 | } 16 | 17 | class _MyAppState extends State<_MyApp> { 18 | ScanResult scanResult; 19 | 20 | final _flashOnController = TextEditingController(text: "Flash on"); 21 | final _flashOffController = TextEditingController(text: "Flash off"); 22 | final _cancelController = TextEditingController(text: "Cancel"); 23 | 24 | var _aspectTolerance = 0.00; 25 | var _numberOfCameras = 0; 26 | var _selectedCamera = -1; 27 | var _useAutoFocus = true; 28 | var _autoEnableFlash = false; 29 | 30 | static final _possibleFormats = BarcodeFormat.values.toList() 31 | ..removeWhere((e) => e == BarcodeFormat.unknown); 32 | 33 | List selectedFormats = [..._possibleFormats]; 34 | 35 | @override 36 | // ignore: type_annotate_public_apis 37 | initState() { 38 | super.initState(); 39 | 40 | Future.delayed(Duration.zero, () async { 41 | _numberOfCameras = await BarcodeScanner.numberOfCameras; 42 | setState(() {}); 43 | }); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | var contentList = [ 49 | if (scanResult != null) 50 | Card( 51 | child: Column( 52 | children: [ 53 | ListTile( 54 | title: Text("Result Type"), 55 | subtitle: Text(scanResult.type?.toString() ?? ""), 56 | ), 57 | ListTile( 58 | title: Text("Raw Content"), 59 | subtitle: Text(scanResult.rawContent ?? ""), 60 | ), 61 | ListTile( 62 | title: Text("Format"), 63 | subtitle: Text(scanResult.format?.toString() ?? ""), 64 | ), 65 | ListTile( 66 | title: Text("Format note"), 67 | subtitle: Text(scanResult.formatNote ?? ""), 68 | ), 69 | ], 70 | ), 71 | ), 72 | ListTile( 73 | title: Text("Camera selection"), 74 | dense: true, 75 | enabled: false, 76 | ), 77 | RadioListTile( 78 | onChanged: (v) => setState(() => _selectedCamera = -1), 79 | value: -1, 80 | title: Text("Default camera"), 81 | groupValue: _selectedCamera, 82 | ), 83 | ]; 84 | 85 | for (var i = 0; i < _numberOfCameras; i++) { 86 | contentList.add(RadioListTile( 87 | onChanged: (v) => setState(() => _selectedCamera = i), 88 | value: i, 89 | title: Text("Camera ${i + 1}"), 90 | groupValue: _selectedCamera, 91 | )); 92 | } 93 | 94 | contentList.addAll([ 95 | ListTile( 96 | title: Text("Button Texts"), 97 | dense: true, 98 | enabled: false, 99 | ), 100 | ListTile( 101 | title: TextField( 102 | decoration: InputDecoration( 103 | hasFloatingPlaceholder: true, 104 | labelText: "Flash On", 105 | ), 106 | controller: _flashOnController, 107 | ), 108 | ), 109 | ListTile( 110 | title: TextField( 111 | decoration: InputDecoration( 112 | hasFloatingPlaceholder: true, 113 | labelText: "Flash Off", 114 | ), 115 | controller: _flashOffController, 116 | ), 117 | ), 118 | ListTile( 119 | title: TextField( 120 | decoration: InputDecoration( 121 | hasFloatingPlaceholder: true, 122 | labelText: "Cancel", 123 | ), 124 | controller: _cancelController, 125 | ), 126 | ), 127 | ]); 128 | 129 | if (Platform.isAndroid) { 130 | contentList.addAll([ 131 | ListTile( 132 | title: Text("Android specific options"), 133 | dense: true, 134 | enabled: false, 135 | ), 136 | ListTile( 137 | title: 138 | Text("Aspect tolerance (${_aspectTolerance.toStringAsFixed(2)})"), 139 | subtitle: Slider( 140 | min: -1.0, 141 | max: 1.0, 142 | value: _aspectTolerance, 143 | onChanged: (value) { 144 | setState(() { 145 | _aspectTolerance = value; 146 | }); 147 | }, 148 | ), 149 | ), 150 | CheckboxListTile( 151 | title: Text("Use autofocus"), 152 | value: _useAutoFocus, 153 | onChanged: (checked) { 154 | setState(() { 155 | _useAutoFocus = checked; 156 | }); 157 | }, 158 | ) 159 | ]); 160 | } 161 | 162 | contentList.addAll([ 163 | ListTile( 164 | title: Text("Other options"), 165 | dense: true, 166 | enabled: false, 167 | ), 168 | CheckboxListTile( 169 | title: Text("Start with flash"), 170 | value: _autoEnableFlash, 171 | onChanged: (checked) { 172 | setState(() { 173 | _autoEnableFlash = checked; 174 | }); 175 | }, 176 | ) 177 | ]); 178 | 179 | contentList.addAll([ 180 | ListTile( 181 | title: Text("Barcode formats"), 182 | dense: true, 183 | enabled: false, 184 | ), 185 | ListTile( 186 | trailing: Checkbox( 187 | tristate: true, 188 | materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, 189 | value: selectedFormats.length == _possibleFormats.length 190 | ? true 191 | : selectedFormats.length == 0 ? false : null, 192 | onChanged: (checked) { 193 | setState(() { 194 | selectedFormats = [ 195 | if (checked ?? false) ..._possibleFormats, 196 | ]; 197 | }); 198 | }, 199 | ), 200 | dense: true, 201 | enabled: false, 202 | title: Text("Detect barcode formats"), 203 | subtitle: Text( 204 | 'If all are unselected, all possible platform formats will be used', 205 | ), 206 | ), 207 | ]); 208 | 209 | contentList.addAll(_possibleFormats.map( 210 | (format) => CheckboxListTile( 211 | value: selectedFormats.contains(format), 212 | onChanged: (i) { 213 | setState(() => selectedFormats.contains(format) 214 | ? selectedFormats.remove(format) 215 | : selectedFormats.add(format)); 216 | }, 217 | title: Text(format.toString()), 218 | ), 219 | )); 220 | 221 | return MaterialApp( 222 | debugShowCheckedModeBanner: false, 223 | home: Scaffold( 224 | appBar: AppBar( 225 | title: Text('Barcode Scanner Example'), 226 | actions: [ 227 | IconButton( 228 | icon: Icon(Icons.camera), 229 | tooltip: "Scan", 230 | onPressed: scan, 231 | ) 232 | ], 233 | ), 234 | body: ListView( 235 | scrollDirection: Axis.vertical, 236 | shrinkWrap: true, 237 | children: contentList, 238 | ), 239 | ), 240 | ); 241 | } 242 | 243 | Future scan() async { 244 | try { 245 | var options = ScanOptions( 246 | strings: { 247 | "cancel": _cancelController.text, 248 | "flash_on": _flashOnController.text, 249 | "flash_off": _flashOffController.text, 250 | }, 251 | restrictFormat: selectedFormats, 252 | useCamera: _selectedCamera, 253 | autoEnableFlash: _autoEnableFlash, 254 | android: AndroidOptions( 255 | aspectTolerance: _aspectTolerance, 256 | useAutoFocus: _useAutoFocus, 257 | ), 258 | ); 259 | 260 | var result = await BarcodeScanner.scan(options: options); 261 | 262 | setState(() => scanResult = result); 263 | } on PlatformException catch (e) { 264 | var result = ScanResult( 265 | type: ResultType.Error, 266 | format: BarcodeFormat.unknown, 267 | ); 268 | 269 | if (e.code == BarcodeScanner.cameraAccessDenied) { 270 | setState(() { 271 | result.rawContent = 'The user did not grant the camera permission!'; 272 | }); 273 | } else { 274 | result.rawContent = 'Unknown error: $e'; 275 | } 276 | setState(() { 277 | scanResult = result; 278 | }); 279 | } 280 | } 281 | } 282 | -------------------------------------------------------------------------------- /ios/Classes/protos/protos.pb.swift: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. 2 | // 3 | // Generated by the Swift generator plugin for the protocol buffer compiler. 4 | // Source: protos/protos.proto 5 | // 6 | // For information on using the generated types, please see the documentation: 7 | // https://github.com/apple/swift-protobuf/ 8 | 9 | // AUTO GENERATED FILE, DO NOT EDIT! 10 | // 11 | // Generated by ./generate_proto.sh 12 | 13 | import Foundation 14 | import SwiftProtobuf 15 | 16 | // If the compiler emits an error on this type, it is because this file 17 | // was generated by a version of the `protoc` Swift plug-in that is 18 | // incompatible with the version of SwiftProtobuf to which you are linking. 19 | // Please ensure that your are building against the same version of the API 20 | // that was used to generate this file. 21 | fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { 22 | struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} 23 | typealias Version = _2 24 | } 25 | 26 | /// protos/barcode_format.proto 27 | enum BarcodeFormat: SwiftProtobuf.Enum { 28 | typealias RawValue = Int 29 | case unknown // = 0 30 | case aztec // = 1 31 | case code39 // = 2 32 | case code93 // = 3 33 | case ean8 // = 4 34 | case ean13 // = 5 35 | case code128 // = 6 36 | case dataMatrix // = 7 37 | case qr // = 8 38 | case interleaved2Of5 // = 9 39 | case upce // = 10 40 | case pdf417 // = 11 41 | case UNRECOGNIZED(Int) 42 | 43 | init() { 44 | self = .unknown 45 | } 46 | 47 | init?(rawValue: Int) { 48 | switch rawValue { 49 | case 0: self = .unknown 50 | case 1: self = .aztec 51 | case 2: self = .code39 52 | case 3: self = .code93 53 | case 4: self = .ean8 54 | case 5: self = .ean13 55 | case 6: self = .code128 56 | case 7: self = .dataMatrix 57 | case 8: self = .qr 58 | case 9: self = .interleaved2Of5 59 | case 10: self = .upce 60 | case 11: self = .pdf417 61 | default: self = .UNRECOGNIZED(rawValue) 62 | } 63 | } 64 | 65 | var rawValue: Int { 66 | switch self { 67 | case .unknown: return 0 68 | case .aztec: return 1 69 | case .code39: return 2 70 | case .code93: return 3 71 | case .ean8: return 4 72 | case .ean13: return 5 73 | case .code128: return 6 74 | case .dataMatrix: return 7 75 | case .qr: return 8 76 | case .interleaved2Of5: return 9 77 | case .upce: return 10 78 | case .pdf417: return 11 79 | case .UNRECOGNIZED(let i): return i 80 | } 81 | } 82 | 83 | } 84 | 85 | #if swift(>=4.2) 86 | 87 | extension BarcodeFormat: CaseIterable { 88 | // The compiler won't synthesize support with the UNRECOGNIZED case. 89 | static var allCases: [BarcodeFormat] = [ 90 | .unknown, 91 | .aztec, 92 | .code39, 93 | .code93, 94 | .ean8, 95 | .ean13, 96 | .code128, 97 | .dataMatrix, 98 | .qr, 99 | .interleaved2Of5, 100 | .upce, 101 | .pdf417, 102 | ] 103 | } 104 | 105 | #endif // swift(>=4.2) 106 | 107 | /// protos/scan_result.proto 108 | enum ResultType: SwiftProtobuf.Enum { 109 | typealias RawValue = Int 110 | case barcode // = 0 111 | case cancelled // = 1 112 | case error // = 2 113 | case UNRECOGNIZED(Int) 114 | 115 | init() { 116 | self = .barcode 117 | } 118 | 119 | init?(rawValue: Int) { 120 | switch rawValue { 121 | case 0: self = .barcode 122 | case 1: self = .cancelled 123 | case 2: self = .error 124 | default: self = .UNRECOGNIZED(rawValue) 125 | } 126 | } 127 | 128 | var rawValue: Int { 129 | switch self { 130 | case .barcode: return 0 131 | case .cancelled: return 1 132 | case .error: return 2 133 | case .UNRECOGNIZED(let i): return i 134 | } 135 | } 136 | 137 | } 138 | 139 | #if swift(>=4.2) 140 | 141 | extension ResultType: CaseIterable { 142 | // The compiler won't synthesize support with the UNRECOGNIZED case. 143 | static var allCases: [ResultType] = [ 144 | .barcode, 145 | .cancelled, 146 | .error, 147 | ] 148 | } 149 | 150 | #endif // swift(>=4.2) 151 | 152 | /// protos/android_configuration.proto 153 | struct AndroidConfiguration { 154 | // SwiftProtobuf.Message conformance is added in an extension below. See the 155 | // `Message` and `Message+*Additions` files in the SwiftProtobuf library for 156 | // methods supported on all messages. 157 | 158 | /// You can optionally set aspect ratio tolerance level 159 | /// that is used in calculating the optimal Camera preview size. 160 | /// On several Huawei devices you need to set this to 0.5. 161 | /// This parameter is only supported on Android devices. 162 | var aspectTolerance: Double = 0 163 | 164 | /// Set to true to enable auto focus 165 | /// This parameter is only supported on Android devices. 166 | var useAutoFocus: Bool = false 167 | 168 | var unknownFields = SwiftProtobuf.UnknownStorage() 169 | 170 | init() {} 171 | } 172 | 173 | /// protos/configuration.proto 174 | struct Configuration { 175 | // SwiftProtobuf.Message conformance is added in an extension below. See the 176 | // `Message` and `Message+*Additions` files in the SwiftProtobuf library for 177 | // methods supported on all messages. 178 | 179 | /// Strings which are displayed to the user 180 | var strings: Dictionary { 181 | get {return _storage._strings} 182 | set {_uniqueStorage()._strings = newValue} 183 | } 184 | 185 | /// Restricts the barcode format which should be read 186 | var restrictFormat: [BarcodeFormat] { 187 | get {return _storage._restrictFormat} 188 | set {_uniqueStorage()._restrictFormat = newValue} 189 | } 190 | 191 | /// Index of the camera which should used. -1 uses the default camera 192 | var useCamera: Int32 { 193 | get {return _storage._useCamera} 194 | set {_uniqueStorage()._useCamera = newValue} 195 | } 196 | 197 | /// Android specific configuration 198 | var android: AndroidConfiguration { 199 | get {return _storage._android ?? AndroidConfiguration()} 200 | set {_uniqueStorage()._android = newValue} 201 | } 202 | /// Returns true if `android` has been explicitly set. 203 | var hasAndroid: Bool {return _storage._android != nil} 204 | /// Clears the value of `android`. Subsequent reads from it will return its default value. 205 | mutating func clearAndroid() {_uniqueStorage()._android = nil} 206 | 207 | /// Set to true to automatically enable flash on camera start 208 | var autoEnableFlash: Bool { 209 | get {return _storage._autoEnableFlash} 210 | set {_uniqueStorage()._autoEnableFlash = newValue} 211 | } 212 | 213 | var unknownFields = SwiftProtobuf.UnknownStorage() 214 | 215 | init() {} 216 | 217 | fileprivate var _storage = _StorageClass.defaultInstance 218 | } 219 | 220 | struct ScanResult { 221 | // SwiftProtobuf.Message conformance is added in an extension below. See the 222 | // `Message` and `Message+*Additions` files in the SwiftProtobuf library for 223 | // methods supported on all messages. 224 | 225 | /// Represents the type of the result 226 | var type: ResultType = .barcode 227 | 228 | /// The barcode itself if the result type is barcode. 229 | /// If the result type is error it contains the error message 230 | var rawContent: String = String() 231 | 232 | /// The barcode format 233 | var format: BarcodeFormat = .unknown 234 | 235 | /// If the format is unknown, this field holds additional information 236 | var formatNote: String = String() 237 | 238 | var unknownFields = SwiftProtobuf.UnknownStorage() 239 | 240 | init() {} 241 | } 242 | 243 | // MARK: - Code below here is support for the SwiftProtobuf runtime. 244 | 245 | extension BarcodeFormat: SwiftProtobuf._ProtoNameProviding { 246 | static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 247 | 0: .same(proto: "unknown"), 248 | 1: .same(proto: "aztec"), 249 | 2: .same(proto: "code39"), 250 | 3: .same(proto: "code93"), 251 | 4: .same(proto: "ean8"), 252 | 5: .same(proto: "ean13"), 253 | 6: .same(proto: "code128"), 254 | 7: .same(proto: "dataMatrix"), 255 | 8: .same(proto: "qr"), 256 | 9: .same(proto: "interleaved2of5"), 257 | 10: .same(proto: "upce"), 258 | 11: .same(proto: "pdf417"), 259 | ] 260 | } 261 | 262 | extension ResultType: SwiftProtobuf._ProtoNameProviding { 263 | static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 264 | 0: .same(proto: "Barcode"), 265 | 1: .same(proto: "Cancelled"), 266 | 2: .same(proto: "Error"), 267 | ] 268 | } 269 | 270 | extension AndroidConfiguration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { 271 | static let protoMessageName: String = "AndroidConfiguration" 272 | static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 273 | 1: .same(proto: "aspectTolerance"), 274 | 2: .same(proto: "useAutoFocus"), 275 | ] 276 | 277 | mutating func decodeMessage(decoder: inout D) throws { 278 | while let fieldNumber = try decoder.nextFieldNumber() { 279 | switch fieldNumber { 280 | case 1: try decoder.decodeSingularDoubleField(value: &self.aspectTolerance) 281 | case 2: try decoder.decodeSingularBoolField(value: &self.useAutoFocus) 282 | default: break 283 | } 284 | } 285 | } 286 | 287 | func traverse(visitor: inout V) throws { 288 | if self.aspectTolerance != 0 { 289 | try visitor.visitSingularDoubleField(value: self.aspectTolerance, fieldNumber: 1) 290 | } 291 | if self.useAutoFocus != false { 292 | try visitor.visitSingularBoolField(value: self.useAutoFocus, fieldNumber: 2) 293 | } 294 | try unknownFields.traverse(visitor: &visitor) 295 | } 296 | 297 | static func ==(lhs: AndroidConfiguration, rhs: AndroidConfiguration) -> Bool { 298 | if lhs.aspectTolerance != rhs.aspectTolerance {return false} 299 | if lhs.useAutoFocus != rhs.useAutoFocus {return false} 300 | if lhs.unknownFields != rhs.unknownFields {return false} 301 | return true 302 | } 303 | } 304 | 305 | extension Configuration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { 306 | static let protoMessageName: String = "Configuration" 307 | static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 308 | 1: .same(proto: "strings"), 309 | 2: .same(proto: "restrictFormat"), 310 | 3: .same(proto: "useCamera"), 311 | 4: .same(proto: "android"), 312 | 5: .same(proto: "autoEnableFlash"), 313 | ] 314 | 315 | fileprivate class _StorageClass { 316 | var _strings: Dictionary = [:] 317 | var _restrictFormat: [BarcodeFormat] = [] 318 | var _useCamera: Int32 = 0 319 | var _android: AndroidConfiguration? = nil 320 | var _autoEnableFlash: Bool = false 321 | 322 | static let defaultInstance = _StorageClass() 323 | 324 | private init() {} 325 | 326 | init(copying source: _StorageClass) { 327 | _strings = source._strings 328 | _restrictFormat = source._restrictFormat 329 | _useCamera = source._useCamera 330 | _android = source._android 331 | _autoEnableFlash = source._autoEnableFlash 332 | } 333 | } 334 | 335 | fileprivate mutating func _uniqueStorage() -> _StorageClass { 336 | if !isKnownUniquelyReferenced(&_storage) { 337 | _storage = _StorageClass(copying: _storage) 338 | } 339 | return _storage 340 | } 341 | 342 | mutating func decodeMessage(decoder: inout D) throws { 343 | _ = _uniqueStorage() 344 | try withExtendedLifetime(_storage) { (_storage: _StorageClass) in 345 | while let fieldNumber = try decoder.nextFieldNumber() { 346 | switch fieldNumber { 347 | case 1: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &_storage._strings) 348 | case 2: try decoder.decodeRepeatedEnumField(value: &_storage._restrictFormat) 349 | case 3: try decoder.decodeSingularInt32Field(value: &_storage._useCamera) 350 | case 4: try decoder.decodeSingularMessageField(value: &_storage._android) 351 | case 5: try decoder.decodeSingularBoolField(value: &_storage._autoEnableFlash) 352 | default: break 353 | } 354 | } 355 | } 356 | } 357 | 358 | func traverse(visitor: inout V) throws { 359 | try withExtendedLifetime(_storage) { (_storage: _StorageClass) in 360 | if !_storage._strings.isEmpty { 361 | try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: _storage._strings, fieldNumber: 1) 362 | } 363 | if !_storage._restrictFormat.isEmpty { 364 | try visitor.visitPackedEnumField(value: _storage._restrictFormat, fieldNumber: 2) 365 | } 366 | if _storage._useCamera != 0 { 367 | try visitor.visitSingularInt32Field(value: _storage._useCamera, fieldNumber: 3) 368 | } 369 | if let v = _storage._android { 370 | try visitor.visitSingularMessageField(value: v, fieldNumber: 4) 371 | } 372 | if _storage._autoEnableFlash != false { 373 | try visitor.visitSingularBoolField(value: _storage._autoEnableFlash, fieldNumber: 5) 374 | } 375 | } 376 | try unknownFields.traverse(visitor: &visitor) 377 | } 378 | 379 | static func ==(lhs: Configuration, rhs: Configuration) -> Bool { 380 | if lhs._storage !== rhs._storage { 381 | let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in 382 | let _storage = _args.0 383 | let rhs_storage = _args.1 384 | if _storage._strings != rhs_storage._strings {return false} 385 | if _storage._restrictFormat != rhs_storage._restrictFormat {return false} 386 | if _storage._useCamera != rhs_storage._useCamera {return false} 387 | if _storage._android != rhs_storage._android {return false} 388 | if _storage._autoEnableFlash != rhs_storage._autoEnableFlash {return false} 389 | return true 390 | } 391 | if !storagesAreEqual {return false} 392 | } 393 | if lhs.unknownFields != rhs.unknownFields {return false} 394 | return true 395 | } 396 | } 397 | 398 | extension ScanResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { 399 | static let protoMessageName: String = "ScanResult" 400 | static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 401 | 1: .same(proto: "type"), 402 | 2: .same(proto: "rawContent"), 403 | 3: .same(proto: "format"), 404 | 4: .same(proto: "formatNote"), 405 | ] 406 | 407 | mutating func decodeMessage(decoder: inout D) throws { 408 | while let fieldNumber = try decoder.nextFieldNumber() { 409 | switch fieldNumber { 410 | case 1: try decoder.decodeSingularEnumField(value: &self.type) 411 | case 2: try decoder.decodeSingularStringField(value: &self.rawContent) 412 | case 3: try decoder.decodeSingularEnumField(value: &self.format) 413 | case 4: try decoder.decodeSingularStringField(value: &self.formatNote) 414 | default: break 415 | } 416 | } 417 | } 418 | 419 | func traverse(visitor: inout V) throws { 420 | if self.type != .barcode { 421 | try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1) 422 | } 423 | if !self.rawContent.isEmpty { 424 | try visitor.visitSingularStringField(value: self.rawContent, fieldNumber: 2) 425 | } 426 | if self.format != .unknown { 427 | try visitor.visitSingularEnumField(value: self.format, fieldNumber: 3) 428 | } 429 | if !self.formatNote.isEmpty { 430 | try visitor.visitSingularStringField(value: self.formatNote, fieldNumber: 4) 431 | } 432 | try unknownFields.traverse(visitor: &visitor) 433 | } 434 | 435 | static func ==(lhs: ScanResult, rhs: ScanResult) -> Bool { 436 | if lhs.type != rhs.type {return false} 437 | if lhs.rawContent != rhs.rawContent {return false} 438 | if lhs.format != rhs.format {return false} 439 | if lhs.formatNote != rhs.formatNote {return false} 440 | if lhs.unknownFields != rhs.unknownFields {return false} 441 | return true 442 | } 443 | } 444 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 7653189528CDB38D81F071AC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5523A44C42E07F9A51E97C1C /* Pods_Runner.framework */; }; 16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 2B94998A8FD1F35BDDA9CF38 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 5523A44C42E07F9A51E97C1C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 46 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 48 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 49 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 50 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 51 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | B1F721BA52D4BAFE2D980861 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 57 | E24CC3DB754EBEA554F5A548 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | 7653189528CDB38D81F071AC /* Pods_Runner.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 31A30000EF797A796C3BAB0A /* Frameworks */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 5523A44C42E07F9A51E97C1C /* Pods_Runner.framework */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | 3BA09A18C234B5BAED215BD9 /* Pods */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | E24CC3DB754EBEA554F5A548 /* Pods-Runner.debug.xcconfig */, 86 | B1F721BA52D4BAFE2D980861 /* Pods-Runner.release.xcconfig */, 87 | 2B94998A8FD1F35BDDA9CF38 /* Pods-Runner.profile.xcconfig */, 88 | ); 89 | path = Pods; 90 | sourceTree = ""; 91 | }; 92 | 9740EEB11CF90186004384FC /* Flutter */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 3B80C3931E831B6300D905FE /* App.framework */, 96 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 97 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 98 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 99 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 100 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 101 | ); 102 | name = Flutter; 103 | sourceTree = ""; 104 | }; 105 | 97C146E51CF9000F007C117D = { 106 | isa = PBXGroup; 107 | children = ( 108 | 9740EEB11CF90186004384FC /* Flutter */, 109 | 97C146F01CF9000F007C117D /* Runner */, 110 | 97C146EF1CF9000F007C117D /* Products */, 111 | 3BA09A18C234B5BAED215BD9 /* Pods */, 112 | 31A30000EF797A796C3BAB0A /* Frameworks */, 113 | ); 114 | sourceTree = ""; 115 | }; 116 | 97C146EF1CF9000F007C117D /* Products */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 97C146EE1CF9000F007C117D /* Runner.app */, 120 | ); 121 | name = Products; 122 | sourceTree = ""; 123 | }; 124 | 97C146F01CF9000F007C117D /* Runner */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 128 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 129 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 130 | 97C147021CF9000F007C117D /* Info.plist */, 131 | 97C146F11CF9000F007C117D /* Supporting Files */, 132 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 133 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 134 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 135 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 136 | ); 137 | path = Runner; 138 | sourceTree = ""; 139 | }; 140 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | ); 144 | name = "Supporting Files"; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 97C146ED1CF9000F007C117D /* Runner */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 153 | buildPhases = ( 154 | 994C2DB70967A36973150014 /* [CP] Check Pods Manifest.lock */, 155 | 9740EEB61CF901F6004384FC /* Run Script */, 156 | 97C146EA1CF9000F007C117D /* Sources */, 157 | 97C146EB1CF9000F007C117D /* Frameworks */, 158 | 97C146EC1CF9000F007C117D /* Resources */, 159 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 160 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 161 | CC5E0DFCC5D00AADA969C942 /* [CP] Embed Pods Frameworks */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = Runner; 168 | productName = Runner; 169 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | 97C146E61CF9000F007C117D /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | LastUpgradeCheck = 1020; 179 | ORGANIZATIONNAME = "The Chromium Authors"; 180 | TargetAttributes = { 181 | 97C146ED1CF9000F007C117D = { 182 | CreatedOnToolsVersion = 7.3.1; 183 | DevelopmentTeam = 7Q347WZM25; 184 | LastSwiftMigration = 1100; 185 | }; 186 | }; 187 | }; 188 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 189 | compatibilityVersion = "Xcode 3.2"; 190 | developmentRegion = en; 191 | hasScannedForEncodings = 0; 192 | knownRegions = ( 193 | en, 194 | Base, 195 | ); 196 | mainGroup = 97C146E51CF9000F007C117D; 197 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 198 | projectDirPath = ""; 199 | projectRoot = ""; 200 | targets = ( 201 | 97C146ED1CF9000F007C117D /* Runner */, 202 | ); 203 | }; 204 | /* End PBXProject section */ 205 | 206 | /* Begin PBXResourcesBuildPhase section */ 207 | 97C146EC1CF9000F007C117D /* Resources */ = { 208 | isa = PBXResourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 212 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 213 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 214 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXResourcesBuildPhase section */ 219 | 220 | /* Begin PBXShellScriptBuildPhase section */ 221 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 222 | isa = PBXShellScriptBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | inputPaths = ( 227 | ); 228 | name = "Thin Binary"; 229 | outputPaths = ( 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | shellPath = /bin/sh; 233 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 234 | }; 235 | 9740EEB61CF901F6004384FC /* Run Script */ = { 236 | isa = PBXShellScriptBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | ); 240 | inputPaths = ( 241 | ); 242 | name = "Run Script"; 243 | outputPaths = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | shellPath = /bin/sh; 247 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 248 | }; 249 | 994C2DB70967A36973150014 /* [CP] Check Pods Manifest.lock */ = { 250 | isa = PBXShellScriptBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | ); 254 | inputFileListPaths = ( 255 | ); 256 | inputPaths = ( 257 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 258 | "${PODS_ROOT}/Manifest.lock", 259 | ); 260 | name = "[CP] Check Pods Manifest.lock"; 261 | outputFileListPaths = ( 262 | ); 263 | outputPaths = ( 264 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | shellPath = /bin/sh; 268 | 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"; 269 | showEnvVarsInLog = 0; 270 | }; 271 | CC5E0DFCC5D00AADA969C942 /* [CP] Embed Pods Frameworks */ = { 272 | isa = PBXShellScriptBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | inputPaths = ( 277 | ); 278 | name = "[CP] Embed Pods Frameworks"; 279 | outputPaths = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | shellPath = /bin/sh; 283 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 284 | showEnvVarsInLog = 0; 285 | }; 286 | /* End PBXShellScriptBuildPhase section */ 287 | 288 | /* Begin PBXSourcesBuildPhase section */ 289 | 97C146EA1CF9000F007C117D /* Sources */ = { 290 | isa = PBXSourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 294 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | /* End PBXSourcesBuildPhase section */ 299 | 300 | /* Begin PBXVariantGroup section */ 301 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 302 | isa = PBXVariantGroup; 303 | children = ( 304 | 97C146FB1CF9000F007C117D /* Base */, 305 | ); 306 | name = Main.storyboard; 307 | sourceTree = ""; 308 | }; 309 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 310 | isa = PBXVariantGroup; 311 | children = ( 312 | 97C147001CF9000F007C117D /* Base */, 313 | ); 314 | name = LaunchScreen.storyboard; 315 | sourceTree = ""; 316 | }; 317 | /* End PBXVariantGroup section */ 318 | 319 | /* Begin XCBuildConfiguration section */ 320 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 321 | isa = XCBuildConfiguration; 322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 323 | buildSettings = { 324 | ALWAYS_SEARCH_USER_PATHS = NO; 325 | CLANG_ANALYZER_NONNULL = YES; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_COMMA = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INFINITE_RECURSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 341 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 342 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 345 | CLANG_WARN_STRICT_PROTOTYPES = YES; 346 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 347 | CLANG_WARN_UNREACHABLE_CODE = YES; 348 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 349 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 350 | COPY_PHASE_STRIP = NO; 351 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 352 | ENABLE_NS_ASSERTIONS = NO; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | GCC_C_LANGUAGE_STANDARD = gnu99; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 357 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 358 | GCC_WARN_UNDECLARED_SELECTOR = YES; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 360 | GCC_WARN_UNUSED_FUNCTION = YES; 361 | GCC_WARN_UNUSED_VARIABLE = YES; 362 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 363 | MTL_ENABLE_DEBUG_INFO = NO; 364 | SDKROOT = iphoneos; 365 | SUPPORTED_PLATFORMS = iphoneos; 366 | TARGETED_DEVICE_FAMILY = "1,2"; 367 | VALIDATE_PRODUCT = YES; 368 | }; 369 | name = Profile; 370 | }; 371 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 372 | isa = XCBuildConfiguration; 373 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | CLANG_ENABLE_MODULES = YES; 377 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 378 | DEVELOPMENT_TEAM = 7Q347WZM25; 379 | ENABLE_BITCODE = NO; 380 | FRAMEWORK_SEARCH_PATHS = ( 381 | "$(inherited)", 382 | "$(PROJECT_DIR)/Flutter", 383 | ); 384 | INFOPLIST_FILE = Runner/Info.plist; 385 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 387 | LIBRARY_SEARCH_PATHS = ( 388 | "$(inherited)", 389 | "$(PROJECT_DIR)/Flutter", 390 | ); 391 | PRODUCT_BUNDLE_IDENTIFIER = de.mintware.barcode_scan.plugin.example; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 394 | SWIFT_VERSION = 5.0; 395 | VERSIONING_SYSTEM = "apple-generic"; 396 | }; 397 | name = Profile; 398 | }; 399 | 97C147031CF9000F007C117D /* Debug */ = { 400 | isa = XCBuildConfiguration; 401 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 402 | buildSettings = { 403 | ALWAYS_SEARCH_USER_PATHS = NO; 404 | CLANG_ANALYZER_NONNULL = YES; 405 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 406 | CLANG_CXX_LIBRARY = "libc++"; 407 | CLANG_ENABLE_MODULES = YES; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_COMMA = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 414 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 415 | CLANG_WARN_EMPTY_BODY = YES; 416 | CLANG_WARN_ENUM_CONVERSION = YES; 417 | CLANG_WARN_INFINITE_RECURSION = YES; 418 | CLANG_WARN_INT_CONVERSION = YES; 419 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 421 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 422 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 423 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 424 | CLANG_WARN_STRICT_PROTOTYPES = YES; 425 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 426 | CLANG_WARN_UNREACHABLE_CODE = YES; 427 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 428 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 429 | COPY_PHASE_STRIP = NO; 430 | DEBUG_INFORMATION_FORMAT = dwarf; 431 | ENABLE_STRICT_OBJC_MSGSEND = YES; 432 | ENABLE_TESTABILITY = YES; 433 | GCC_C_LANGUAGE_STANDARD = gnu99; 434 | GCC_DYNAMIC_NO_PIC = NO; 435 | GCC_NO_COMMON_BLOCKS = YES; 436 | GCC_OPTIMIZATION_LEVEL = 0; 437 | GCC_PREPROCESSOR_DEFINITIONS = ( 438 | "DEBUG=1", 439 | "$(inherited)", 440 | ); 441 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 442 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 443 | GCC_WARN_UNDECLARED_SELECTOR = YES; 444 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 445 | GCC_WARN_UNUSED_FUNCTION = YES; 446 | GCC_WARN_UNUSED_VARIABLE = YES; 447 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 448 | MTL_ENABLE_DEBUG_INFO = YES; 449 | ONLY_ACTIVE_ARCH = YES; 450 | SDKROOT = iphoneos; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | }; 453 | name = Debug; 454 | }; 455 | 97C147041CF9000F007C117D /* Release */ = { 456 | isa = XCBuildConfiguration; 457 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 458 | buildSettings = { 459 | ALWAYS_SEARCH_USER_PATHS = NO; 460 | CLANG_ANALYZER_NONNULL = YES; 461 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 462 | CLANG_CXX_LIBRARY = "libc++"; 463 | CLANG_ENABLE_MODULES = YES; 464 | CLANG_ENABLE_OBJC_ARC = YES; 465 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 466 | CLANG_WARN_BOOL_CONVERSION = YES; 467 | CLANG_WARN_COMMA = YES; 468 | CLANG_WARN_CONSTANT_CONVERSION = YES; 469 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 470 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 471 | CLANG_WARN_EMPTY_BODY = YES; 472 | CLANG_WARN_ENUM_CONVERSION = YES; 473 | CLANG_WARN_INFINITE_RECURSION = YES; 474 | CLANG_WARN_INT_CONVERSION = YES; 475 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 476 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 477 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 478 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 479 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 480 | CLANG_WARN_STRICT_PROTOTYPES = YES; 481 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 482 | CLANG_WARN_UNREACHABLE_CODE = YES; 483 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 484 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 485 | COPY_PHASE_STRIP = NO; 486 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 487 | ENABLE_NS_ASSERTIONS = NO; 488 | ENABLE_STRICT_OBJC_MSGSEND = YES; 489 | GCC_C_LANGUAGE_STANDARD = gnu99; 490 | GCC_NO_COMMON_BLOCKS = YES; 491 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 492 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 493 | GCC_WARN_UNDECLARED_SELECTOR = YES; 494 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 495 | GCC_WARN_UNUSED_FUNCTION = YES; 496 | GCC_WARN_UNUSED_VARIABLE = YES; 497 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 498 | MTL_ENABLE_DEBUG_INFO = NO; 499 | SDKROOT = iphoneos; 500 | SUPPORTED_PLATFORMS = iphoneos; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 502 | TARGETED_DEVICE_FAMILY = "1,2"; 503 | VALIDATE_PRODUCT = YES; 504 | }; 505 | name = Release; 506 | }; 507 | 97C147061CF9000F007C117D /* Debug */ = { 508 | isa = XCBuildConfiguration; 509 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CLANG_ENABLE_MODULES = YES; 513 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 514 | DEVELOPMENT_TEAM = 7Q347WZM25; 515 | ENABLE_BITCODE = NO; 516 | FRAMEWORK_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "$(PROJECT_DIR)/Flutter", 519 | ); 520 | INFOPLIST_FILE = Runner/Info.plist; 521 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 523 | LIBRARY_SEARCH_PATHS = ( 524 | "$(inherited)", 525 | "$(PROJECT_DIR)/Flutter", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = de.mintware.barcode_scan.plugin.example; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 530 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 531 | SWIFT_VERSION = 5.0; 532 | VERSIONING_SYSTEM = "apple-generic"; 533 | }; 534 | name = Debug; 535 | }; 536 | 97C147071CF9000F007C117D /* Release */ = { 537 | isa = XCBuildConfiguration; 538 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 539 | buildSettings = { 540 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 541 | CLANG_ENABLE_MODULES = YES; 542 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 543 | DEVELOPMENT_TEAM = 7Q347WZM25; 544 | ENABLE_BITCODE = NO; 545 | FRAMEWORK_SEARCH_PATHS = ( 546 | "$(inherited)", 547 | "$(PROJECT_DIR)/Flutter", 548 | ); 549 | INFOPLIST_FILE = Runner/Info.plist; 550 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 551 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 552 | LIBRARY_SEARCH_PATHS = ( 553 | "$(inherited)", 554 | "$(PROJECT_DIR)/Flutter", 555 | ); 556 | PRODUCT_BUNDLE_IDENTIFIER = de.mintware.barcode_scan.plugin.example; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 559 | SWIFT_VERSION = 5.0; 560 | VERSIONING_SYSTEM = "apple-generic"; 561 | }; 562 | name = Release; 563 | }; 564 | /* End XCBuildConfiguration section */ 565 | 566 | /* Begin XCConfigurationList section */ 567 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | 97C147031CF9000F007C117D /* Debug */, 571 | 97C147041CF9000F007C117D /* Release */, 572 | 249021D3217E4FDB00AE95B9 /* Profile */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 97C147061CF9000F007C117D /* Debug */, 581 | 97C147071CF9000F007C117D /* Release */, 582 | 249021D4217E4FDB00AE95B9 /* Profile */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | /* End XCConfigurationList section */ 588 | }; 589 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 590 | } 591 | --------------------------------------------------------------------------------