├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── kotlin │ └── org │ └── eyrefree │ └── qrcoder │ └── QrcoderPlugin.kt ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── org │ │ │ │ │ └── eyrefree │ │ │ │ │ └── qrcoder_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── 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 │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── 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-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── QrcoderPlugin.h │ ├── QrcoderPlugin.m │ └── SwiftQrcoderPlugin.swift └── qrcoder.podspec ├── lib ├── an_error.dart ├── bch_util.dart ├── int_extension.dart ├── qr_8bit_byte.dart ├── qr_bit_buffer.dart ├── qr_error_correct_level.dart ├── qr_mask_pattern.dart ├── qr_math.dart ├── qr_mode.dart ├── qr_pattern_locator.dart ├── qr_polynomial.dart ├── qr_rs_block.dart ├── qrcode.dart ├── qrcode_model.dart ├── qrcode_type.dart └── qrcoder.dart ├── pubspec.lock ├── pubspec.yaml ├── qrcoder.iml └── test └── qrcoder_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | .idea/ 8 | .vagrant/ 9 | .sconsign.dblite 10 | .svn/ 11 | 12 | *.swp 13 | profile 14 | 15 | DerivedData/ 16 | 17 | .generated/ 18 | 19 | *.pbxuser 20 | *.mode1v3 21 | *.mode2v3 22 | *.perspectivev3 23 | 24 | !default.pbxuser 25 | !default.mode1v3 26 | !default.mode2v3 27 | !default.perspectivev3 28 | 29 | xcuserdata 30 | 31 | *.moved-aside 32 | 33 | *.pyc 34 | *sync/ 35 | Icon? 36 | .tags* 37 | 38 | build/ 39 | .android/ 40 | .ios/ 41 | .flutter-plugins 42 | .flutter-plugins-dependencies 43 | 44 | # Symbolication related 45 | app.*.symbols 46 | 47 | # Obfuscation related 48 | app.*.map.json 49 | -------------------------------------------------------------------------------- /.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: f7a6a7906be96d2288f5d63a5a54c515a6e987fe 8 | channel: unknown 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ----- 4 | 5 | ## [0.2.0](https://github.com/EyreFree/qrcoder/releases/tag/0.2.0) (2020-09-14) 6 | 7 | - Support more platforms. 8 | 9 | --- 10 | 11 | ## [0.1.0](https://github.com/EyreFree/qrcoder/releases/tag/0.1.0) (2020-09-14) 12 | 13 | - Generate qrcode matrix. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 EyreFree 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # qrcoder 2 | 3 | [![pub package](https://img.shields.io/pub/v/qrcoder.svg)](https://pub.dartlang.org/packages/qrcoder) 4 | 5 | Yet another stupid dart qrcode plugin, modified from [qrcodejs](https://github.com/davidshimjs/qrcodejs) & [swift_qrcodejs](https://github.com/ApolloZhu/swift_qrcodejs). 6 | 7 | ## Use 8 | 9 | 1. Dependency 10 | 11 | In your `pubspec.yaml`, add the following config: 12 | 13 | ```yaml 14 | dependencies: 15 | qrcoder: 0.2.0 16 | ``` 17 | 18 | 2. Generate 19 | 20 | The method statement is as follows: 21 | 22 | ```dart 23 | static Future>> generateQRCodeMatrix( 24 | String text, {Encoding encoding = utf8, QRErrorCorrectLevel errorCorrectLevel = QRErrorCorrectLevel.H, bool hasBorder = true} 25 | ) 26 | ``` 27 | 28 | You can call this method liek this: 29 | 30 | ```dart 31 | var matrix = await Qrcoder.generateQRCodeMatrix('2333', hasBorder: false); 32 | print(matrix); 33 | ``` 34 | 35 | For more information, you can see the [example](https://github.com/EyreFree/qrcoder/tree/master/example) project. 36 | 37 | ## Author 38 | 39 | EyreFree, eyrefree@eyrefree.org 40 | 41 | ## License 42 | 43 | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/License_icon-mit-88x31-2.svg/128px-License_icon-mit-88x31-2.svg.png) 44 | 45 | This project is available under the MIT license. See the LICENSE file for more info. 46 | -------------------------------------------------------------------------------- /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/build.gradle: -------------------------------------------------------------------------------- 1 | group 'org.eyrefree.qrcoder' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.3.50' 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | sourceSets { 31 | main.java.srcDirs += 'src/main/kotlin' 32 | } 33 | defaultConfig { 34 | minSdkVersion 16 35 | } 36 | lintOptions { 37 | disable 'InvalidPackage' 38 | } 39 | } 40 | 41 | dependencies { 42 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 43 | } 44 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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.6.2-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'qrcoder' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/kotlin/org/eyrefree/qrcoder/QrcoderPlugin.kt: -------------------------------------------------------------------------------- 1 | package org.eyrefree.qrcoder 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import io.flutter.embedding.engine.plugins.FlutterPlugin 6 | import io.flutter.plugin.common.MethodCall 7 | import io.flutter.plugin.common.MethodChannel 8 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 9 | import io.flutter.plugin.common.MethodChannel.Result 10 | import io.flutter.plugin.common.PluginRegistry.Registrar 11 | 12 | /** QrcoderPlugin */ 13 | public class QrcoderPlugin: FlutterPlugin, MethodCallHandler { 14 | /// The MethodChannel that will the communication between Flutter and native Android 15 | /// 16 | /// This local reference serves to register the plugin with the Flutter Engine and unregister it 17 | /// when the Flutter Engine is detached from the Activity 18 | private lateinit var channel : MethodChannel 19 | 20 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 21 | channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "qrcoder") 22 | channel.setMethodCallHandler(this); 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 | @JvmStatic 36 | fun registerWith(registrar: Registrar) { 37 | val channel = MethodChannel(registrar.messenger(), "qrcoder") 38 | channel.setMethodCallHandler(QrcoderPlugin()) 39 | } 40 | } 41 | 42 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { 43 | if (call.method == "getPlatformVersion") { 44 | result.success("Android ${android.os.Build.VERSION.RELEASE}") 45 | } else { 46 | result.notImplemented() 47 | } 48 | } 49 | 50 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 51 | channel.setMethodCallHandler(null) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /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: f7a6a7906be96d2288f5d63a5a54c515a6e987fe 8 | channel: unknown 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # qrcoder_example 2 | 3 | Demonstrates how to use the qrcoder plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /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 "org.eyrefree.qrcoder_example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/org/eyrefree/qrcoder_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package org.eyrefree.qrcoder_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 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/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | post_install do |installer| 82 | installer.pods_project.targets.each do |target| 83 | target.build_configurations.each do |config| 84 | config.build_settings['ENABLE_BITCODE'] = 'NO' 85 | end 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - Flutter (from `Flutter`) 6 | 7 | EXTERNAL SOURCES: 8 | Flutter: 9 | :path: Flutter 10 | 11 | SPEC CHECKSUMS: 12 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 13 | 14 | PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a 15 | 16 | COCOAPODS: 1.9.3 17 | -------------------------------------------------------------------------------- /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 | 18483ECCE14F66A2FD4F74F3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4654849CBE9A589D0E49DF93 /* Pods_Runner.framework */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 4654849CBE9A589D0E49DF93 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 5F8D03B22DB237D855A2CA80 /* 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 = ""; }; 38 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 39 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 41 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 42 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 43 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | A2E2094413D4A0B41464A8DA /* 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 = ""; }; 49 | BA93B227F5787651E54D11A5 /* 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 = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 18483ECCE14F66A2FD4F74F3 /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 19E912FC5952FA3FFA4A3762 /* Pods */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | BA93B227F5787651E54D11A5 /* Pods-Runner.debug.xcconfig */, 68 | A2E2094413D4A0B41464A8DA /* Pods-Runner.release.xcconfig */, 69 | 5F8D03B22DB237D855A2CA80 /* Pods-Runner.profile.xcconfig */, 70 | ); 71 | name = Pods; 72 | path = Pods; 73 | sourceTree = ""; 74 | }; 75 | 556BAD985378368DE7EBFAA6 /* Frameworks */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 4654849CBE9A589D0E49DF93 /* Pods_Runner.framework */, 79 | ); 80 | name = Frameworks; 81 | sourceTree = ""; 82 | }; 83 | 9740EEB11CF90186004384FC /* Flutter */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 87 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 88 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 89 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 90 | ); 91 | name = Flutter; 92 | sourceTree = ""; 93 | }; 94 | 97C146E51CF9000F007C117D = { 95 | isa = PBXGroup; 96 | children = ( 97 | 9740EEB11CF90186004384FC /* Flutter */, 98 | 97C146F01CF9000F007C117D /* Runner */, 99 | 97C146EF1CF9000F007C117D /* Products */, 100 | 19E912FC5952FA3FFA4A3762 /* Pods */, 101 | 556BAD985378368DE7EBFAA6 /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 97C146EF1CF9000F007C117D /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146EE1CF9000F007C117D /* Runner.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 97C146F01CF9000F007C117D /* Runner */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 117 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 118 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 119 | 97C147021CF9000F007C117D /* Info.plist */, 120 | 97C146F11CF9000F007C117D /* Supporting Files */, 121 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 122 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 123 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 124 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 125 | ); 126 | path = Runner; 127 | sourceTree = ""; 128 | }; 129 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | 97C146ED1CF9000F007C117D /* Runner */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 142 | buildPhases = ( 143 | 231A6FACA3314BC8CCD97135 /* [CP] Check Pods Manifest.lock */, 144 | 9740EEB61CF901F6004384FC /* Run Script */, 145 | 97C146EA1CF9000F007C117D /* Sources */, 146 | 97C146EB1CF9000F007C117D /* Frameworks */, 147 | 97C146EC1CF9000F007C117D /* Resources */, 148 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 149 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 150 | 6F77870298BEA24D16F46289 /* [CP] Embed Pods Frameworks */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = Runner; 157 | productName = Runner; 158 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | /* End PBXNativeTarget section */ 162 | 163 | /* Begin PBXProject section */ 164 | 97C146E61CF9000F007C117D /* Project object */ = { 165 | isa = PBXProject; 166 | attributes = { 167 | LastUpgradeCheck = 1020; 168 | ORGANIZATIONNAME = ""; 169 | TargetAttributes = { 170 | 97C146ED1CF9000F007C117D = { 171 | CreatedOnToolsVersion = 7.3.1; 172 | LastSwiftMigration = 1100; 173 | }; 174 | }; 175 | }; 176 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 177 | compatibilityVersion = "Xcode 9.3"; 178 | developmentRegion = en; 179 | hasScannedForEncodings = 0; 180 | knownRegions = ( 181 | en, 182 | Base, 183 | ); 184 | mainGroup = 97C146E51CF9000F007C117D; 185 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 186 | projectDirPath = ""; 187 | projectRoot = ""; 188 | targets = ( 189 | 97C146ED1CF9000F007C117D /* Runner */, 190 | ); 191 | }; 192 | /* End PBXProject section */ 193 | 194 | /* Begin PBXResourcesBuildPhase section */ 195 | 97C146EC1CF9000F007C117D /* Resources */ = { 196 | isa = PBXResourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 200 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 201 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 202 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXResourcesBuildPhase section */ 207 | 208 | /* Begin PBXShellScriptBuildPhase section */ 209 | 231A6FACA3314BC8CCD97135 /* [CP] Check Pods Manifest.lock */ = { 210 | isa = PBXShellScriptBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | ); 214 | inputFileListPaths = ( 215 | ); 216 | inputPaths = ( 217 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 218 | "${PODS_ROOT}/Manifest.lock", 219 | ); 220 | name = "[CP] Check Pods Manifest.lock"; 221 | outputFileListPaths = ( 222 | ); 223 | outputPaths = ( 224 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | shellPath = /bin/sh; 228 | 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"; 229 | showEnvVarsInLog = 0; 230 | }; 231 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 232 | isa = PBXShellScriptBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | ); 236 | inputPaths = ( 237 | ); 238 | name = "Thin Binary"; 239 | outputPaths = ( 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | shellPath = /bin/sh; 243 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 244 | }; 245 | 6F77870298BEA24D16F46289 /* [CP] Embed Pods Frameworks */ = { 246 | isa = PBXShellScriptBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | inputPaths = ( 251 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 252 | "${PODS_ROOT}/../Flutter/Flutter.framework", 253 | ); 254 | name = "[CP] Embed Pods Frameworks"; 255 | outputPaths = ( 256 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | shellPath = /bin/sh; 260 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 261 | showEnvVarsInLog = 0; 262 | }; 263 | 9740EEB61CF901F6004384FC /* Run Script */ = { 264 | isa = PBXShellScriptBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | ); 268 | inputPaths = ( 269 | ); 270 | name = "Run Script"; 271 | outputPaths = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | shellPath = /bin/sh; 275 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 276 | }; 277 | /* End PBXShellScriptBuildPhase section */ 278 | 279 | /* Begin PBXSourcesBuildPhase section */ 280 | 97C146EA1CF9000F007C117D /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 285 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | /* End PBXSourcesBuildPhase section */ 290 | 291 | /* Begin PBXVariantGroup section */ 292 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 293 | isa = PBXVariantGroup; 294 | children = ( 295 | 97C146FB1CF9000F007C117D /* Base */, 296 | ); 297 | name = Main.storyboard; 298 | sourceTree = ""; 299 | }; 300 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 301 | isa = PBXVariantGroup; 302 | children = ( 303 | 97C147001CF9000F007C117D /* Base */, 304 | ); 305 | name = LaunchScreen.storyboard; 306 | sourceTree = ""; 307 | }; 308 | /* End PBXVariantGroup section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 312 | isa = XCBuildConfiguration; 313 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | CLANG_ANALYZER_NONNULL = YES; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 322 | CLANG_WARN_BOOL_CONVERSION = YES; 323 | CLANG_WARN_COMMA = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_EMPTY_BODY = YES; 328 | CLANG_WARN_ENUM_CONVERSION = YES; 329 | CLANG_WARN_INFINITE_RECURSION = YES; 330 | CLANG_WARN_INT_CONVERSION = YES; 331 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 333 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 335 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 336 | CLANG_WARN_STRICT_PROTOTYPES = YES; 337 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 338 | CLANG_WARN_UNREACHABLE_CODE = YES; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 343 | ENABLE_NS_ASSERTIONS = NO; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu99; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | SUPPORTED_PLATFORMS = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | VALIDATE_PRODUCT = YES; 359 | }; 360 | name = Profile; 361 | }; 362 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 363 | isa = XCBuildConfiguration; 364 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | CLANG_ENABLE_MODULES = YES; 368 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 369 | ENABLE_BITCODE = NO; 370 | FRAMEWORK_SEARCH_PATHS = ( 371 | "$(inherited)", 372 | "$(PROJECT_DIR)/Flutter", 373 | ); 374 | INFOPLIST_FILE = Runner/Info.plist; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 376 | LIBRARY_SEARCH_PATHS = ( 377 | "$(inherited)", 378 | "$(PROJECT_DIR)/Flutter", 379 | ); 380 | PRODUCT_BUNDLE_IDENTIFIER = org.eyrefree.qrcoderExample; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 383 | SWIFT_VERSION = 5.0; 384 | VERSIONING_SYSTEM = "apple-generic"; 385 | }; 386 | name = Profile; 387 | }; 388 | 97C147031CF9000F007C117D /* Debug */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = dwarf; 420 | ENABLE_STRICT_OBJC_MSGSEND = YES; 421 | ENABLE_TESTABILITY = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_DYNAMIC_NO_PIC = NO; 424 | GCC_NO_COMMON_BLOCKS = YES; 425 | GCC_OPTIMIZATION_LEVEL = 0; 426 | GCC_PREPROCESSOR_DEFINITIONS = ( 427 | "DEBUG=1", 428 | "$(inherited)", 429 | ); 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 437 | MTL_ENABLE_DEBUG_INFO = YES; 438 | ONLY_ACTIVE_ARCH = YES; 439 | SDKROOT = iphoneos; 440 | TARGETED_DEVICE_FAMILY = "1,2"; 441 | }; 442 | name = Debug; 443 | }; 444 | 97C147041CF9000F007C117D /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 447 | buildSettings = { 448 | ALWAYS_SEARCH_USER_PATHS = NO; 449 | CLANG_ANALYZER_NONNULL = YES; 450 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 451 | CLANG_CXX_LIBRARY = "libc++"; 452 | CLANG_ENABLE_MODULES = YES; 453 | CLANG_ENABLE_OBJC_ARC = YES; 454 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 455 | CLANG_WARN_BOOL_CONVERSION = YES; 456 | CLANG_WARN_COMMA = YES; 457 | CLANG_WARN_CONSTANT_CONVERSION = YES; 458 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 459 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 460 | CLANG_WARN_EMPTY_BODY = YES; 461 | CLANG_WARN_ENUM_CONVERSION = YES; 462 | CLANG_WARN_INFINITE_RECURSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 465 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 466 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 467 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 468 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 469 | CLANG_WARN_STRICT_PROTOTYPES = YES; 470 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 471 | CLANG_WARN_UNREACHABLE_CODE = YES; 472 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 473 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 474 | COPY_PHASE_STRIP = NO; 475 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 476 | ENABLE_NS_ASSERTIONS = NO; 477 | ENABLE_STRICT_OBJC_MSGSEND = YES; 478 | GCC_C_LANGUAGE_STANDARD = gnu99; 479 | GCC_NO_COMMON_BLOCKS = YES; 480 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 481 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 482 | GCC_WARN_UNDECLARED_SELECTOR = YES; 483 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 484 | GCC_WARN_UNUSED_FUNCTION = YES; 485 | GCC_WARN_UNUSED_VARIABLE = YES; 486 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 487 | MTL_ENABLE_DEBUG_INFO = NO; 488 | SDKROOT = iphoneos; 489 | SUPPORTED_PLATFORMS = iphoneos; 490 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 491 | TARGETED_DEVICE_FAMILY = "1,2"; 492 | VALIDATE_PRODUCT = YES; 493 | }; 494 | name = Release; 495 | }; 496 | 97C147061CF9000F007C117D /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 499 | buildSettings = { 500 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 501 | CLANG_ENABLE_MODULES = YES; 502 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 503 | ENABLE_BITCODE = NO; 504 | FRAMEWORK_SEARCH_PATHS = ( 505 | "$(inherited)", 506 | "$(PROJECT_DIR)/Flutter", 507 | ); 508 | INFOPLIST_FILE = Runner/Info.plist; 509 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 510 | LIBRARY_SEARCH_PATHS = ( 511 | "$(inherited)", 512 | "$(PROJECT_DIR)/Flutter", 513 | ); 514 | PRODUCT_BUNDLE_IDENTIFIER = org.eyrefree.qrcoderExample; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 517 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 518 | SWIFT_VERSION = 5.0; 519 | VERSIONING_SYSTEM = "apple-generic"; 520 | }; 521 | name = Debug; 522 | }; 523 | 97C147071CF9000F007C117D /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 526 | buildSettings = { 527 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 528 | CLANG_ENABLE_MODULES = YES; 529 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 530 | ENABLE_BITCODE = NO; 531 | FRAMEWORK_SEARCH_PATHS = ( 532 | "$(inherited)", 533 | "$(PROJECT_DIR)/Flutter", 534 | ); 535 | INFOPLIST_FILE = Runner/Info.plist; 536 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 537 | LIBRARY_SEARCH_PATHS = ( 538 | "$(inherited)", 539 | "$(PROJECT_DIR)/Flutter", 540 | ); 541 | PRODUCT_BUNDLE_IDENTIFIER = org.eyrefree.qrcoderExample; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 544 | SWIFT_VERSION = 5.0; 545 | VERSIONING_SYSTEM = "apple-generic"; 546 | }; 547 | name = Release; 548 | }; 549 | /* End XCBuildConfiguration section */ 550 | 551 | /* Begin XCConfigurationList section */ 552 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 553 | isa = XCConfigurationList; 554 | buildConfigurations = ( 555 | 97C147031CF9000F007C117D /* Debug */, 556 | 97C147041CF9000F007C117D /* Release */, 557 | 249021D3217E4FDB00AE95B9 /* Profile */, 558 | ); 559 | defaultConfigurationIsVisible = 0; 560 | defaultConfigurationName = Release; 561 | }; 562 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 563 | isa = XCConfigurationList; 564 | buildConfigurations = ( 565 | 97C147061CF9000F007C117D /* Debug */, 566 | 97C147071CF9000F007C117D /* Release */, 567 | 249021D4217E4FDB00AE95B9 /* Profile */, 568 | ); 569 | defaultConfigurationIsVisible = 0; 570 | defaultConfigurationName = Release; 571 | }; 572 | /* End XCConfigurationList section */ 573 | }; 574 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 575 | } 576 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/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/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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 | qrcoder_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:async'; 3 | 4 | import 'package:flutter/services.dart'; 5 | import 'package:qrcoder/qrcoder.dart'; 6 | 7 | void main() { 8 | runApp(MyApp()); 9 | } 10 | 11 | class MyApp extends StatefulWidget { 12 | @override 13 | _MyAppState createState() => _MyAppState(); 14 | } 15 | 16 | class _MyAppState extends State { 17 | String _platformVersion = 'Unknown'; 18 | 19 | @override 20 | void initState() { 21 | super.initState(); 22 | initPlatformState(); 23 | } 24 | 25 | // Platform messages are asynchronous, so we initialize in an async method. 26 | Future initPlatformState() async { 27 | String platformVersion; 28 | // Platform messages may fail, so we use a try/catch PlatformException. 29 | try { 30 | platformVersion = '2333';// await Qrcoder.platformVersion; 31 | } on PlatformException { 32 | platformVersion = 'Failed to get platform version.'; 33 | } 34 | 35 | // If the widget was removed from the tree while the asynchronous platform 36 | // message was in flight, we want to discard the reply rather than calling 37 | // setState to update our non-existent appearance. 38 | if (!mounted) return; 39 | 40 | setState(() { 41 | _platformVersion = platformVersion; 42 | }); 43 | } 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | return MaterialApp( 48 | home: Scaffold( 49 | appBar: AppBar( 50 | title: const Text('Plugin example app'), 51 | ), 52 | body: Center( 53 | child: FlatButton( 54 | child: Text("Test"), 55 | onPressed: () async { 56 | var matrixString = 57 | await Qrcoder.generateQRCodeMatrixStringFilledAndPatchedWith( 58 | '2333', 59 | hasBorder: false); 60 | print(matrixString); 61 | }, 62 | ), 63 | ), 64 | ), 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.13" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.6.0" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.1" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.0.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.3" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.12" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.4" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.1.3" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | image: 78 | dependency: transitive 79 | description: 80 | name: image 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "2.1.12" 84 | matcher: 85 | dependency: transitive 86 | description: 87 | name: matcher 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.12.6" 91 | meta: 92 | dependency: transitive 93 | description: 94 | name: meta 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.1.8" 98 | path: 99 | dependency: transitive 100 | description: 101 | name: path 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.6.4" 105 | petitparser: 106 | dependency: transitive 107 | description: 108 | name: petitparser 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "2.4.0" 112 | qrcoder: 113 | dependency: "direct main" 114 | description: 115 | path: ".." 116 | relative: true 117 | source: path 118 | version: "0.2.0" 119 | quiver: 120 | dependency: transitive 121 | description: 122 | name: quiver 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "2.1.3" 126 | sky_engine: 127 | dependency: transitive 128 | description: flutter 129 | source: sdk 130 | version: "0.0.99" 131 | source_span: 132 | dependency: transitive 133 | description: 134 | name: source_span 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.7.0" 138 | stack_trace: 139 | dependency: transitive 140 | description: 141 | name: stack_trace 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.9.3" 145 | stream_channel: 146 | dependency: transitive 147 | description: 148 | name: stream_channel 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "2.0.0" 152 | string_scanner: 153 | dependency: transitive 154 | description: 155 | name: string_scanner 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.0.5" 159 | term_glyph: 160 | dependency: transitive 161 | description: 162 | name: term_glyph 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.0" 166 | test_api: 167 | dependency: transitive 168 | description: 169 | name: test_api 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.2.15" 173 | typed_data: 174 | dependency: transitive 175 | description: 176 | name: typed_data 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.1.6" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.0.8" 187 | xml: 188 | dependency: transitive 189 | description: 190 | name: xml 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "3.6.1" 194 | sdks: 195 | dart: ">=2.7.0 <3.0.0" 196 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: qrcoder_example 2 | description: Demonstrates how to use the qrcoder plugin. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | environment: 9 | sdk: ">=2.7.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | qrcoder: 16 | # When depending on this package from a real application you should use: 17 | # qrcoder: ^x.y.z 18 | # See https://dart.dev/tools/pub/dependencies#version-constraints 19 | # The example app is bundled with the plugin so we use a path dependency on 20 | # the parent directory to use the current plugin's version. 21 | path: ../ 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.3 26 | 27 | dev_dependencies: 28 | flutter_test: 29 | sdk: flutter 30 | 31 | # For information on the generic Dart part of this file, see the 32 | # following page: https://dart.dev/tools/pub/pubspec 33 | 34 | # The following section is specific to Flutter. 35 | flutter: 36 | 37 | # The following line ensures that the Material Icons font is 38 | # included with your application, so that you can use the icons in 39 | # the material Icons class. 40 | uses-material-design: true 41 | 42 | # To add assets to your application, add an assets section, like this: 43 | # assets: 44 | # - images/a_dot_burr.jpeg 45 | # - images/a_dot_ham.jpeg 46 | 47 | # An image asset can refer to one or more resolution-specific "variants", see 48 | # https://flutter.dev/assets-and-images/#resolution-aware. 49 | 50 | # For details regarding adding assets from package dependencies, see 51 | # https://flutter.dev/assets-and-images/#from-packages 52 | 53 | # To add custom fonts to your application, add a fonts section here, 54 | # in this "flutter" section. Each entry in this list should have a 55 | # "family" key with the font family name, and a "fonts" key with a 56 | # list giving the asset and other descriptors for the font. For 57 | # example: 58 | # fonts: 59 | # - family: Schyler 60 | # fonts: 61 | # - asset: fonts/Schyler-Regular.ttf 62 | # - asset: fonts/Schyler-Italic.ttf 63 | # style: italic 64 | # - family: Trajan Pro 65 | # fonts: 66 | # - asset: fonts/TrajanPro.ttf 67 | # - asset: fonts/TrajanPro_Bold.ttf 68 | # weight: 700 69 | # 70 | # For details regarding fonts from package dependencies, 71 | # see https://flutter.dev/custom-fonts/#from-packages 72 | -------------------------------------------------------------------------------- /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 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:qrcoder_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => widget is Text && 22 | widget.data.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /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/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/qrcoder/faeac3e679c7fd7f5d97d4737d49503dfed00dab/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/QrcoderPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface QrcoderPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/QrcoderPlugin.m: -------------------------------------------------------------------------------- 1 | #import "QrcoderPlugin.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 "qrcoder-Swift.h" 9 | #endif 10 | 11 | @implementation QrcoderPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftQrcoderPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /ios/Classes/SwiftQrcoderPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | public class SwiftQrcoderPlugin: NSObject, FlutterPlugin { 5 | public static func register(with registrar: FlutterPluginRegistrar) { 6 | let channel = FlutterMethodChannel(name: "qrcoder", binaryMessenger: registrar.messenger()) 7 | let instance = SwiftQrcoderPlugin() 8 | registrar.addMethodCallDelegate(instance, channel: channel) 9 | } 10 | 11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 12 | result("iOS " + UIDevice.current.systemVersion) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ios/qrcoder.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint qrcoder.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'qrcoder' 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.platform = :ios, '8.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } 22 | s.swift_version = '5.0' 23 | end 24 | -------------------------------------------------------------------------------- /lib/an_error.dart: -------------------------------------------------------------------------------- 1 | class AnError implements Exception { 2 | final message; 3 | 4 | AnError([this.message]); 5 | } 6 | -------------------------------------------------------------------------------- /lib/bch_util.dart: -------------------------------------------------------------------------------- 1 | import 'int_extension.dart'; 2 | 3 | class BCHUtil { 4 | static const int _g15 = 1335; // 0b10100110111 5 | static const int _g18 = 7973; // 0b1111100100101 6 | static const int _g15Mask = 21522; // 0b101010000010010 7 | static final int _g15BCHDigit = bchDigitOf(_g15); 8 | static final int _g18BCHDigit = bchDigitOf(_g18); 9 | 10 | static int bchTypeInfoOf(int data) { 11 | int d = data << 10; 12 | while (bchDigitOf(d) - _g15BCHDigit >= 0) { 13 | d ^= (_g15 << (bchDigitOf(d) - _g15BCHDigit)); 14 | } 15 | return ((data << 10) | d) ^ _g15Mask; 16 | } 17 | 18 | static int bchTypeNumberOf(int data) { 19 | int d = data << 12; 20 | while (bchDigitOf(d) - _g18BCHDigit >= 0) { 21 | d ^= (_g18 << (bchDigitOf(d) - _g18BCHDigit)); 22 | } 23 | return (data << 12) | d; 24 | } 25 | 26 | static int bchDigitOf(int data) { 27 | int digit = 0; 28 | while (data != 0) { 29 | digit += 1; 30 | data = data.zeroFillRightShift(1); 31 | } 32 | return digit; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/int_extension.dart: -------------------------------------------------------------------------------- 1 | extension intExtension on int { 2 | int zeroFillRightShift(int amount) { 3 | //return this/*.toUnsigned(this.bitLength)*/ >> amount; 4 | //int xxx = (this & 0xffffffff) >> amount; 5 | //return xxx.toUnsigned(xxx.bitLength); 6 | return this >> amount; 7 | //return (this & 0xffffffff) >> amount; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/qr_8bit_byte.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert' show Encoding, utf8; 2 | 3 | import 'an_error.dart'; 4 | import 'qr_bit_buffer.dart'; 5 | import 'qr_mode.dart'; 6 | 7 | class QR8bitByte { 8 | final mode = QRMode.bitByte8; 9 | List parsedData; 10 | 11 | QR8bitByte(String data, {Encoding encoding = utf8}) { 12 | final parsed = encoding.encode(data); 13 | if (parsed == null) { 14 | throw AnError('String data can not be encoded by input encoding.'); 15 | } 16 | parsedData = parsed; 17 | } 18 | 19 | int get count { 20 | return parsedData.length; 21 | } 22 | 23 | void writeTo(QRBitBuffer buffer) { 24 | for (final datium in parsedData) { 25 | buffer.put(datium, 8); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/qr_bit_buffer.dart: -------------------------------------------------------------------------------- 1 | import 'int_extension.dart'; 2 | 3 | class QRBitBuffer { 4 | /// UInt 5 | List buffer = []; 6 | int bitCount = 0; 7 | 8 | bool get(int index) { 9 | final bufIndex = index ~/ 8; 10 | return ((buffer[bufIndex].zeroFillRightShift(7 - index % 8)) & 1) == 1; 11 | } 12 | 13 | bool subscript(int index) { 14 | return get(index); 15 | } 16 | 17 | /// num: UInt 18 | void put(int num, int length) { 19 | for (int i = 0; i < length; i++) { 20 | putBit(((num.zeroFillRightShift(length - i - 1)) & 1) == 1); 21 | } 22 | } 23 | 24 | void putBit(bool bit) { 25 | final bufIndex = bitCount ~/ 8; 26 | if (buffer.length <= bufIndex) { 27 | buffer.add(0); 28 | } 29 | if (bit) { 30 | // 0x80: UInt 31 | buffer[bufIndex] |= (0x80.zeroFillRightShift(bitCount % 8)); 32 | } 33 | bitCount += 1; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/qr_error_correct_level.dart: -------------------------------------------------------------------------------- 1 | import 'an_error.dart'; 2 | 3 | enum QRErrorCorrectLevel { 4 | /// Error resilience level: 7%. 5 | L, // 1 6 | /// Error resilience level: 15%. 7 | M, // 0 8 | /// Error resilience level: 25%. 9 | Q, // 3 10 | /// Error resilience level: 30%. 11 | H, // 2 12 | } 13 | 14 | extension QRErrorCorrectLevelExtension on QRErrorCorrectLevel { 15 | int get rawValue { 16 | switch (this) { 17 | case QRErrorCorrectLevel.L: 18 | return 1; 19 | case QRErrorCorrectLevel.M: 20 | return 0; 21 | case QRErrorCorrectLevel.Q: 22 | return 3; 23 | case QRErrorCorrectLevel.H: 24 | return 2; 25 | } 26 | throw AnError( 27 | 'Should not run into this line, ask author(eyrefree@eyrefree.org) for help.'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/qr_mask_pattern.dart: -------------------------------------------------------------------------------- 1 | import 'an_error.dart'; 2 | 3 | enum QRMaskPattern { 4 | _000, 5 | _001, 6 | _010, 7 | _011, 8 | _100, 9 | _101, 10 | _110, 11 | _111, 12 | } 13 | 14 | extension QRMaskPatternExtension on QRMaskPattern { 15 | int get rawValue { 16 | switch (this) { 17 | case QRMaskPattern._000: 18 | return 0; 19 | case QRMaskPattern._001: 20 | return 1; 21 | case QRMaskPattern._010: 22 | return 2; 23 | case QRMaskPattern._011: 24 | return 3; 25 | case QRMaskPattern._100: 26 | return 4; 27 | case QRMaskPattern._101: 28 | return 5; 29 | case QRMaskPattern._110: 30 | return 6; 31 | case QRMaskPattern._111: 32 | return 7; 33 | } 34 | throw AnError( 35 | 'Should not run into this line, ask author(eyrefree@eyrefree.org) for help.'); 36 | } 37 | 38 | static QRMaskPattern pattern(int rawValue) { 39 | switch (rawValue) { 40 | case 0: 41 | return QRMaskPattern._000; 42 | case 1: 43 | return QRMaskPattern._001; 44 | case 2: 45 | return QRMaskPattern._010; 46 | case 3: 47 | return QRMaskPattern._011; 48 | case 4: 49 | return QRMaskPattern._100; 50 | case 5: 51 | return QRMaskPattern._101; 52 | case 6: 53 | return QRMaskPattern._110; 54 | case 7: 55 | return QRMaskPattern._111; 56 | } 57 | throw AnError( 58 | 'Should not run into this line, ask author(eyrefree@eyrefree.org) for help.'); 59 | } 60 | 61 | bool getMask(int i, int j) { 62 | switch (this) { 63 | case QRMaskPattern._000: 64 | return (i + j) % 2 == 0; 65 | case QRMaskPattern._001: 66 | return i % 2 == 0; 67 | case QRMaskPattern._010: 68 | return j % 3 == 0; 69 | case QRMaskPattern._011: 70 | return (i + j) % 3 == 0; 71 | case QRMaskPattern._100: 72 | return (i / 2 + j / 3) % 2 == 0; 73 | case QRMaskPattern._101: 74 | return (i * j) % 2 + (i * j) % 3 == 0; 75 | case QRMaskPattern._110: 76 | return ((i * j) % 2 + (i * j) % 3) % 2 == 0; 77 | case QRMaskPattern._111: 78 | return ((i * j) % 3 + (i + j) % 2) % 2 == 0; 79 | } 80 | throw AnError( 81 | 'Should not run into this line, ask author(eyrefree@eyrefree.org) for help.'); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/qr_math.dart: -------------------------------------------------------------------------------- 1 | import 'an_error.dart'; 2 | 3 | class QRMath { 4 | static int glog(int n) { 5 | if (n < 1) { 6 | throw AnError('glog only works with n > 0, not \(n)'); 7 | } 8 | return QRMath.instance._LOG_TABLE[n]; 9 | } 10 | 11 | static int gexp(int n) { 12 | int _n = n; 13 | while (_n < 0) { 14 | _n += 255; 15 | } 16 | while (_n >= 256) { 17 | _n -= 255; 18 | } 19 | return QRMath.instance._EXP_TABLE[_n]; 20 | } 21 | 22 | List _EXP_TABLE; 23 | List _LOG_TABLE; 24 | 25 | static final QRMath instance = QRMath._privateConstructor(); 26 | 27 | QRMath._privateConstructor() { 28 | _EXP_TABLE = List.filled(256, 0, growable: false); 29 | _LOG_TABLE = List.filled(256, 0, growable: false); 30 | for (int i = 0; i < 8; i++) { 31 | _EXP_TABLE[i] = 1 << i; 32 | } 33 | for (int i = 8; i < 256; i++) { 34 | _EXP_TABLE[i] = _EXP_TABLE[i - 4] ^ 35 | _EXP_TABLE[i - 5] ^ 36 | _EXP_TABLE[i - 6] ^ 37 | _EXP_TABLE[i - 8]; 38 | } 39 | for (int i = 0; i < 255; i++) { 40 | _LOG_TABLE[_EXP_TABLE[i]] = i; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/qr_mode.dart: -------------------------------------------------------------------------------- 1 | import 'an_error.dart'; 2 | 3 | enum QRMode { 4 | /// 1 << 0 5 | number, // 0b0001, 1 6 | /// 1 << 1 7 | alphaNumber, // 0b0010, 2 8 | /// 1 << 2 9 | bitByte8, // 0b0100, 4 10 | /// 1 << 3 11 | kanji, // 0b1000, 8 12 | } 13 | 14 | extension QRModeExtension on QRMode { 15 | int get rawValue { 16 | switch (this) { 17 | case QRMode.number: 18 | return 1; 19 | case QRMode.alphaNumber: 20 | return 2; 21 | case QRMode.bitByte8: 22 | return 4; 23 | case QRMode.kanji: 24 | return 8; 25 | } 26 | throw AnError( 27 | 'Should not run into this line, ask author(eyrefree@eyrefree.org) for help.'); 28 | } 29 | 30 | int bitCountOfType(int type) { 31 | if (1 <= type && type < 10) { 32 | switch (this) { 33 | case QRMode.number: 34 | return 10; 35 | case QRMode.alphaNumber: 36 | return 9; 37 | case QRMode.bitByte8: 38 | case QRMode.kanji: 39 | return 8; 40 | } 41 | } else if (type < 27) { 42 | switch (this) { 43 | case QRMode.number: 44 | return 12; 45 | case QRMode.alphaNumber: 46 | return 11; 47 | case QRMode.bitByte8: 48 | return 16; 49 | case QRMode.kanji: 50 | return 10; 51 | } 52 | } else if (type < 41) { 53 | switch (this) { 54 | case QRMode.number: 55 | return 14; 56 | case QRMode.alphaNumber: 57 | return 13; 58 | case QRMode.bitByte8: 59 | return 16; 60 | case QRMode.kanji: 61 | return 12; 62 | } 63 | } 64 | throw AnError('Can\'t determine length.'); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/qr_pattern_locator.dart: -------------------------------------------------------------------------------- 1 | class QRPatternLocator { 2 | static const List> _PATTERN_POSITION_TABLE = [ 3 | [], 4 | [6, 18], 5 | [6, 22], 6 | [6, 26], 7 | [6, 30], 8 | [6, 34], 9 | [6, 22, 38], 10 | [6, 24, 42], 11 | [6, 26, 46], 12 | [6, 28, 50], 13 | [6, 30, 54], 14 | [6, 32, 58], 15 | [6, 34, 62], 16 | [6, 26, 46, 66], 17 | [6, 26, 48, 70], 18 | [6, 26, 50, 74], 19 | [6, 30, 54, 78], 20 | [6, 30, 56, 82], 21 | [6, 30, 58, 86], 22 | [6, 34, 62, 90], 23 | [6, 28, 50, 72, 94], 24 | [6, 26, 50, 74, 98], 25 | [6, 30, 54, 78, 102], 26 | [6, 28, 54, 80, 106], 27 | [6, 32, 58, 84, 110], 28 | [6, 30, 58, 86, 114], 29 | [6, 34, 62, 90, 118], 30 | [6, 26, 50, 74, 98, 122], 31 | [6, 30, 54, 78, 102, 126], 32 | [6, 26, 52, 78, 104, 130], 33 | [6, 30, 56, 82, 108, 134], 34 | [6, 34, 60, 86, 112, 138], 35 | [6, 30, 58, 86, 114, 142], 36 | [6, 34, 62, 90, 118, 146], 37 | [6, 30, 54, 78, 102, 126, 150], 38 | [6, 24, 50, 76, 102, 128, 154], 39 | [6, 28, 54, 80, 106, 132, 158], 40 | [6, 32, 58, 84, 110, 136, 162], 41 | [6, 26, 54, 82, 110, 138, 166], 42 | [6, 30, 58, 86, 114, 142, 170] 43 | ]; 44 | 45 | static List getPatternPositionOfType(int typeNumber) { 46 | return _PATTERN_POSITION_TABLE[typeNumber - 1]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/qr_polynomial.dart: -------------------------------------------------------------------------------- 1 | import 'an_error.dart'; 2 | import 'qr_math.dart'; 3 | 4 | class QRPolynomial { 5 | List _numbers = []; 6 | 7 | QRPolynomial(List nums, {int shift = 0}) { 8 | if (nums.length <= 0) { 9 | throw AnError('nums should not be empty.'); 10 | } 11 | 12 | int offset = 0; 13 | while (offset < nums.length && nums[offset] == 0) { 14 | offset += 1; 15 | } 16 | _numbers = 17 | List.filled(nums.length - offset + shift, 0, growable: false); 18 | for (int i = 0; i < nums.length - offset; i++) { 19 | _numbers[i] = nums[i + offset]; 20 | } 21 | } 22 | 23 | int get(int index) { 24 | return _numbers[index]; 25 | } 26 | 27 | int subscript(int index) { 28 | return get(index); 29 | } 30 | 31 | int get count { 32 | return _numbers.length; 33 | } 34 | 35 | QRPolynomial multiplying(QRPolynomial e) { 36 | List nums = List.filled(count + e.count - 1, 0, growable: false); 37 | for (int i = 0; i < count; i++) { 38 | for (int j = 0; j < e.count; j++) { 39 | nums[i + j] ^= QRMath.gexp( 40 | QRMath.glog(this.subscript(i)) + QRMath.glog(e.subscript(j))); 41 | } 42 | } 43 | return QRPolynomial(nums); 44 | } 45 | 46 | QRPolynomial modedBy(QRPolynomial e) { 47 | if (count - e.count < 0) { 48 | return this; 49 | } 50 | int ratio = QRMath.glog(this.subscript(0)) - QRMath.glog(e.subscript(0)); 51 | List num = List.filled(count, 0, growable: false); 52 | for (int i = 0; i < count; ++i) { 53 | num[i] = this.subscript(i); 54 | } 55 | 56 | for (int i = 0; i < e.count; ++i) { 57 | num[i] ^= QRMath.gexp(QRMath.glog(e.subscript(i)) + ratio); 58 | } 59 | return QRPolynomial(num).modedBy(e); 60 | } 61 | 62 | static QRPolynomial errorCorrectPolynomialOfLength(int errorCorrectLength) { 63 | QRPolynomial a = QRPolynomial([1]); 64 | for (int i = 0; i < errorCorrectLength; ++i) { 65 | a = a.multiplying(QRPolynomial([1, QRMath.gexp(i)])); 66 | } 67 | return a; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/qr_rs_block.dart: -------------------------------------------------------------------------------- 1 | import 'an_error.dart'; 2 | import 'qr_error_correct_level.dart'; 3 | 4 | class QRRSBlock { 5 | int totalCount; 6 | int dataCount; 7 | 8 | QRRSBlock(int totalCount, int dataCount) { 9 | this.totalCount = totalCount; 10 | this.dataCount = dataCount; 11 | } 12 | } 13 | 14 | extension _QRRSBlockExtension on QRRSBlock { 15 | static const List> RS_BLOCK_TABLE = [ 16 | [1, 26, 19], 17 | [1, 26, 16], 18 | [1, 26, 13], 19 | [1, 26, 9], 20 | [1, 44, 34], 21 | [1, 44, 28], 22 | [1, 44, 22], 23 | [1, 44, 16], 24 | [1, 70, 55], 25 | [1, 70, 44], 26 | [2, 35, 17], 27 | [2, 35, 13], 28 | [1, 100, 80], 29 | [2, 50, 32], 30 | [2, 50, 24], 31 | [4, 25, 9], 32 | [1, 134, 108], 33 | [2, 67, 43], 34 | [2, 33, 15, 2, 34, 16], 35 | [2, 33, 11, 2, 34, 12], 36 | [2, 86, 68], 37 | [4, 43, 27], 38 | [4, 43, 19], 39 | [4, 43, 15], 40 | [2, 98, 78], 41 | [4, 49, 31], 42 | [2, 32, 14, 4, 33, 15], 43 | [4, 39, 13, 1, 40, 14], 44 | [2, 121, 97], 45 | [2, 60, 38, 2, 61, 39], 46 | [4, 40, 18, 2, 41, 19], 47 | [4, 40, 14, 2, 41, 15], 48 | [2, 146, 116], 49 | [3, 58, 36, 2, 59, 37], 50 | [4, 36, 16, 4, 37, 17], 51 | [4, 36, 12, 4, 37, 13], 52 | [2, 86, 68, 2, 87, 69], 53 | [4, 69, 43, 1, 70, 44], 54 | [6, 43, 19, 2, 44, 20], 55 | [6, 43, 15, 2, 44, 16], 56 | [4, 101, 81], 57 | [1, 80, 50, 4, 81, 51], 58 | [4, 50, 22, 4, 51, 23], 59 | [3, 36, 12, 8, 37, 13], 60 | [2, 116, 92, 2, 117, 93], 61 | [6, 58, 36, 2, 59, 37], 62 | [4, 46, 20, 6, 47, 21], 63 | [7, 42, 14, 4, 43, 15], 64 | [4, 133, 107], 65 | [8, 59, 37, 1, 60, 38], 66 | [8, 44, 20, 4, 45, 21], 67 | [12, 33, 11, 4, 34, 12], 68 | [3, 145, 115, 1, 146, 116], 69 | [4, 64, 40, 5, 65, 41], 70 | [11, 36, 16, 5, 37, 17], 71 | [11, 36, 12, 5, 37, 13], 72 | [5, 109, 87, 1, 110, 88], 73 | [5, 65, 41, 5, 66, 42], 74 | [5, 54, 24, 7, 55, 25], 75 | [11, 36, 12, 7, 37, 13], 76 | [5, 122, 98, 1, 123, 99], 77 | [7, 73, 45, 3, 74, 46], 78 | [15, 43, 19, 2, 44, 20], 79 | [3, 45, 15, 13, 46, 16], 80 | [1, 135, 107, 5, 136, 108], 81 | [10, 74, 46, 1, 75, 47], 82 | [1, 50, 22, 15, 51, 23], 83 | [2, 42, 14, 17, 43, 15], 84 | [5, 150, 120, 1, 151, 121], 85 | [9, 69, 43, 4, 70, 44], 86 | [17, 50, 22, 1, 51, 23], 87 | [2, 42, 14, 19, 43, 15], 88 | [3, 141, 113, 4, 142, 114], 89 | [3, 70, 44, 11, 71, 45], 90 | [17, 47, 21, 4, 48, 22], 91 | [9, 39, 13, 16, 40, 14], 92 | [3, 135, 107, 5, 136, 108], 93 | [3, 67, 41, 13, 68, 42], 94 | [15, 54, 24, 5, 55, 25], 95 | [15, 43, 15, 10, 44, 16], 96 | [4, 144, 116, 4, 145, 117], 97 | [17, 68, 42], 98 | [17, 50, 22, 6, 51, 23], 99 | [19, 46, 16, 6, 47, 17], 100 | [2, 139, 111, 7, 140, 112], 101 | [17, 74, 46], 102 | [7, 54, 24, 16, 55, 25], 103 | [34, 37, 13], 104 | [4, 151, 121, 5, 152, 122], 105 | [4, 75, 47, 14, 76, 48], 106 | [11, 54, 24, 14, 55, 25], 107 | [16, 45, 15, 14, 46, 16], 108 | [6, 147, 117, 4, 148, 118], 109 | [6, 73, 45, 14, 74, 46], 110 | [11, 54, 24, 16, 55, 25], 111 | [30, 46, 16, 2, 47, 17], 112 | [8, 132, 106, 4, 133, 107], 113 | [8, 75, 47, 13, 76, 48], 114 | [7, 54, 24, 22, 55, 25], 115 | [22, 45, 15, 13, 46, 16], 116 | [10, 142, 114, 2, 143, 115], 117 | [19, 74, 46, 4, 75, 47], 118 | [28, 50, 22, 6, 51, 23], 119 | [33, 46, 16, 4, 47, 17], 120 | [8, 152, 122, 4, 153, 123], 121 | [22, 73, 45, 3, 74, 46], 122 | [8, 53, 23, 26, 54, 24], 123 | [12, 45, 15, 28, 46, 16], 124 | [3, 147, 117, 10, 148, 118], 125 | [3, 73, 45, 23, 74, 46], 126 | [4, 54, 24, 31, 55, 25], 127 | [11, 45, 15, 31, 46, 16], 128 | [7, 146, 116, 7, 147, 117], 129 | [21, 73, 45, 7, 74, 46], 130 | [1, 53, 23, 37, 54, 24], 131 | [19, 45, 15, 26, 46, 16], 132 | [5, 145, 115, 10, 146, 116], 133 | [19, 75, 47, 10, 76, 48], 134 | [15, 54, 24, 25, 55, 25], 135 | [23, 45, 15, 25, 46, 16], 136 | [13, 145, 115, 3, 146, 116], 137 | [2, 74, 46, 29, 75, 47], 138 | [42, 54, 24, 1, 55, 25], 139 | [23, 45, 15, 28, 46, 16], 140 | [17, 145, 115], 141 | [10, 74, 46, 23, 75, 47], 142 | [10, 54, 24, 35, 55, 25], 143 | [19, 45, 15, 35, 46, 16], 144 | [17, 145, 115, 1, 146, 116], 145 | [14, 74, 46, 21, 75, 47], 146 | [29, 54, 24, 19, 55, 25], 147 | [11, 45, 15, 46, 46, 16], 148 | [13, 145, 115, 6, 146, 116], 149 | [14, 74, 46, 23, 75, 47], 150 | [44, 54, 24, 7, 55, 25], 151 | [59, 46, 16, 1, 47, 17], 152 | [12, 151, 121, 7, 152, 122], 153 | [12, 75, 47, 26, 76, 48], 154 | [39, 54, 24, 14, 55, 25], 155 | [22, 45, 15, 41, 46, 16], 156 | [6, 151, 121, 14, 152, 122], 157 | [6, 75, 47, 34, 76, 48], 158 | [46, 54, 24, 10, 55, 25], 159 | [2, 45, 15, 64, 46, 16], 160 | [17, 152, 122, 4, 153, 123], 161 | [29, 74, 46, 14, 75, 47], 162 | [49, 54, 24, 10, 55, 25], 163 | [24, 45, 15, 46, 46, 16], 164 | [4, 152, 122, 18, 153, 123], 165 | [13, 74, 46, 32, 75, 47], 166 | [48, 54, 24, 14, 55, 25], 167 | [42, 45, 15, 32, 46, 16], 168 | [20, 147, 117, 4, 148, 118], 169 | [40, 75, 47, 7, 76, 48], 170 | [43, 54, 24, 22, 55, 25], 171 | [10, 45, 15, 67, 46, 16], 172 | [19, 148, 118, 6, 149, 119], 173 | [18, 75, 47, 31, 76, 48], 174 | [34, 54, 24, 34, 55, 25], 175 | [20, 45, 15, 61, 46, 16] 176 | ]; 177 | } 178 | 179 | extension QRErrorCorrectLevelWithQRRSBlockExtension on QRErrorCorrectLevel { 180 | List getRSBlocksOfType(int typeNumber) { 181 | final rsBlock = _getRsBlockTableOfType(typeNumber); 182 | final length = rsBlock.length / 3; 183 | 184 | List list = []; 185 | for (int i = 0; i < length; i++) { 186 | final count = rsBlock[i * 3 + 0]; 187 | final totalCount = rsBlock[i * 3 + 1]; 188 | final dataCount = rsBlock[i * 3 + 2]; 189 | for (int j = 0; j < count; j++) { 190 | list.add(QRRSBlock(totalCount, dataCount)); 191 | } 192 | } 193 | return list; 194 | } 195 | 196 | List _getRsBlockTableOfType(int typeNumber) { 197 | switch (this) { 198 | case QRErrorCorrectLevel.L: 199 | return _QRRSBlockExtension.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; 200 | case QRErrorCorrectLevel.M: 201 | return _QRRSBlockExtension.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; 202 | case QRErrorCorrectLevel.Q: 203 | return _QRRSBlockExtension.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; 204 | case QRErrorCorrectLevel.H: 205 | return _QRRSBlockExtension.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; 206 | } 207 | throw AnError( 208 | 'Should not run into this line, ask author(eyrefree@eyrefree.org) for help.'); 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /lib/qrcode.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:core'; 3 | 4 | import 'qrcode_model.dart'; 5 | import 'qrcode_type.dart'; 6 | import 'qr_error_correct_level.dart'; 7 | 8 | class QRCode { 9 | /// Content. 10 | String text; 11 | 12 | /// Error correct level. 13 | QRErrorCorrectLevel correctLevel; 14 | 15 | /// If the image codes has a border around its content. 16 | bool hasBorder; 17 | int typeNumber; 18 | 19 | QRCodeModel _model; 20 | 21 | /// Construct a QRCode instance. 22 | /// 23 | /// - Parameters: 24 | /// - text: content of the QRCode. 25 | /// - encoding: encoding used for generating data from text. 26 | /// - errorCorrectLevel: error correct level, defaults to high. 27 | /// - hasBorder: if the image codes has a border around, defaults and suggests to be true. 28 | /// 29 | /// - Warning: Is computationally intensive. 30 | QRCode(String text, 31 | {Encoding encoding = utf8, 32 | QRErrorCorrectLevel errorCorrectLevel = QRErrorCorrectLevel.H, 33 | bool hasBorder = true}) { 34 | int typeNumber = QRCodeTypeExtension.typeNumberOf(text, errorCorrectLevel); 35 | QRCodeModel model = 36 | QRCodeModel(text, typeNumber, errorCorrectLevel, encoding: encoding); 37 | this.typeNumber = typeNumber; 38 | this._model = model; 39 | this.text = text; 40 | this.correctLevel = errorCorrectLevel; 41 | this.hasBorder = hasBorder; 42 | } 43 | 44 | /// QRCode in binary form. 45 | List> imageCodes() { 46 | List> ans = []; 47 | if (hasBorder) { 48 | List borderLine = 49 | List.filled(_model.moduleCount + 2, 0, growable: false); 50 | ans.add(borderLine); 51 | for (int r = 0; r < _model.moduleCount; r++) { 52 | List line = [0]; 53 | for (int c = 0; c < _model.moduleCount; c++) { 54 | line.add(_model.isDark(r, c) ? 1 : 0); 55 | } 56 | line.add(0); 57 | ans.add(line); 58 | } 59 | ans.add(borderLine); 60 | } else { 61 | for (int r = 0; r < _model.moduleCount; r++) { 62 | List line = []; 63 | for (int c = 0; c < _model.moduleCount; c++) { 64 | line.add(_model.isDark(r, c) ? 1 : 0); 65 | } 66 | ans.add(line); 67 | } 68 | } 69 | return ans; 70 | } 71 | 72 | /// Convert QRCode to String. 73 | /// 74 | /// - Parameters: 75 | /// - black: recommend to be "\u{1B}[7m " or "##". 76 | /// - white: recommend to be "\u{1B}[0m " or " ". 77 | /// - Returns: a matrix of characters that is scannable. 78 | String toStringFilledAndPatchedWith( 79 | {String black = '⬛️', String white = '⬜️'}) { 80 | String result = ''; 81 | final List> imageCodes = this.imageCodes(); 82 | for (var imageLine in imageCodes) { 83 | String line = ''; 84 | for (var imageCode in imageLine) { 85 | line += (imageCode == 0 ? white : black); 86 | } 87 | result += (line + '\n'); 88 | } 89 | return result; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/qrcode_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert' show Encoding, utf8; 2 | import 'dart:math'; 3 | 4 | import 'qr_rs_block.dart'; 5 | import 'an_error.dart'; 6 | import 'qr_8bit_byte.dart'; 7 | import 'qr_bit_buffer.dart'; 8 | import 'qr_error_correct_level.dart'; 9 | import 'qr_mask_pattern.dart'; 10 | import 'qr_pattern_locator.dart'; 11 | import 'bch_util.dart'; 12 | import 'qr_polynomial.dart'; 13 | import 'qr_mode.dart'; 14 | import 'int_extension.dart'; 15 | 16 | class QRCodeModel { 17 | int typeNumber; 18 | QRErrorCorrectLevel errorCorrectLevel; 19 | 20 | /// -1: null, 0: false, 1: true 21 | List> _modules = []; 22 | int moduleCount = 0; 23 | QR8bitByte _encodedText; 24 | List _dataCache = []; 25 | 26 | QRCodeModel( 27 | String text, int typeNumber, QRErrorCorrectLevel errorCorrectLevel, 28 | {Encoding encoding = utf8}) { 29 | _encodedText = QR8bitByte(text, encoding: encoding); 30 | this.typeNumber = typeNumber; 31 | this.errorCorrectLevel = errorCorrectLevel; 32 | _dataCache = 33 | QRCodeModel._createData(typeNumber, errorCorrectLevel, _encodedText); 34 | 35 | _makeImplIsTest(false, _getBestMaskPattern()); 36 | } 37 | 38 | /// Please be aware of index out of bounds error yourself. 39 | bool isDark(int row, int col) { 40 | return _modules[row][col] == 1; 41 | } 42 | 43 | bool isLight(int row, int col) { 44 | return !isDark(row, col); 45 | } 46 | 47 | void _makeImplIsTest(bool test, QRMaskPattern maskPattern) { 48 | moduleCount = typeNumber * 4 + 17; 49 | _modules = List>.filled(moduleCount, [], growable: false); 50 | for (int i = 0; i < moduleCount; i++) { 51 | _modules[i] = List.filled(moduleCount, -1, growable: false); 52 | } 53 | _setupPositionProbePattern(0, 0); 54 | _setupPositionProbePattern(moduleCount - 7, 0); 55 | _setupPositionProbePattern(0, moduleCount - 7); 56 | _setupPositionAdjustPattern(); 57 | _setupTimingPattern(); 58 | _setupTypeInfoIsTest(test, maskPattern.rawValue); 59 | if (typeNumber >= 7) { 60 | _setupTypeNumberIsTest(test); 61 | } 62 | _mapData(_dataCache, maskPattern); 63 | } 64 | 65 | void _setupPositionProbePattern(int row, int col) { 66 | for (int r = -1; r <= 7; r++) { 67 | if ((row + r <= -1) || (moduleCount <= row + r)) { 68 | continue; 69 | } 70 | for (int c = -1; c <= 7; c++) { 71 | if ((col + c <= -1) || (moduleCount <= col + c)) { 72 | continue; 73 | } 74 | if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || 75 | (0 <= c && c <= 6 && (r == 0 || r == 6)) || 76 | (2 <= r && r <= 4 && 2 <= c && c <= 4)) { 77 | _modules[row + r][col + c] = 1; 78 | } else { 79 | _modules[row + r][col + c] = 0; 80 | } 81 | } 82 | } 83 | } 84 | 85 | void _setupTimingPattern() { 86 | for (int i = 8; i < moduleCount - 8; i++) { 87 | if (_modules[i][6] == -1) { 88 | _modules[i][6] = ((i % 2 == 0) ? 1 : 0); 89 | } 90 | if (_modules[6][i] == -1) { 91 | _modules[6][i] = ((i % 2 == 0) ? 1 : 0); 92 | } 93 | } 94 | } 95 | 96 | void _setupPositionAdjustPattern() { 97 | List pos = QRPatternLocator.getPatternPositionOfType(typeNumber); 98 | for (int i = 0; i < pos.length; i++) { 99 | for (int j = 0; j < pos.length; j++) { 100 | int row = pos[i]; 101 | int col = pos[j]; 102 | if (_modules[row][col] != -1) { 103 | continue; 104 | } 105 | for (int r = -2; r <= 2; r++) { 106 | for (int c = -2; c <= 2; c++) { 107 | if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) { 108 | _modules[row + r][col + c] = 1; 109 | } else { 110 | _modules[row + r][col + c] = 0; 111 | } 112 | } 113 | } 114 | } 115 | } 116 | } 117 | 118 | void _setupTypeNumberIsTest(bool test) { 119 | int bits = BCHUtil.bchTypeNumberOf(typeNumber); 120 | for (int i = 0; i < 18; i++) { 121 | int mod = (!test && ((bits >> i) & 1) == 1) ? 1 : 0; 122 | _modules[i ~/ 3][i % 3 + moduleCount - 8 - 3] = mod; 123 | _modules[i % 3 + moduleCount - 8 - 3][i ~/ 3] = mod; 124 | } 125 | } 126 | 127 | void _setupTypeInfoIsTest(bool test, int maskPattern) { 128 | int data = (errorCorrectLevel.rawValue << 3) | maskPattern; 129 | int bits = BCHUtil.bchTypeInfoOf(data); // To enforce signed shift 130 | for (int i = 0; i < 15; i++) { 131 | int mod = !test && ((bits >> i) & 1) == 1 ? 1 : 0; 132 | 133 | if (i < 6) { 134 | _modules[i][8] = mod; 135 | } else if (i < 8) { 136 | _modules[i + 1][8] = mod; 137 | } else { 138 | _modules[moduleCount - 15 + i][8] = mod; 139 | } 140 | 141 | if (i < 8) { 142 | _modules[8][moduleCount - i - 1] = mod; 143 | } else if (i < 9) { 144 | _modules[8][15 - i - 1 + 1] = mod; 145 | } else { 146 | _modules[8][15 - i - 1] = mod; 147 | } 148 | } 149 | _modules[moduleCount - 8][8] = !test ? 1 : 0; 150 | } 151 | 152 | void _mapData(List data, QRMaskPattern maskPattern) { 153 | int inc = -1; 154 | int row = moduleCount - 1; 155 | int bitIndex = 7; 156 | int byteIndex = 0; 157 | 158 | for (int col = moduleCount - 1; col > 0; col -= 2) { 159 | if (col == 6) { 160 | col -= 1; 161 | } 162 | while (true) { 163 | for (int c = 0; c < 2; c++) { 164 | if (_modules[row][col - c] == -1) { 165 | bool dark = false; 166 | if (byteIndex < data.length) { 167 | int elem = data[byteIndex]; 168 | dark = (elem.zeroFillRightShift(bitIndex) & 1) == 1; 169 | } 170 | bool mask = maskPattern.getMask(row, col - c); 171 | if (mask == true) { 172 | dark = !dark; 173 | } 174 | _modules[row][col - c] = dark ? 1 : 0; 175 | bitIndex -= 1; 176 | if (bitIndex == -1) { 177 | byteIndex += 1; 178 | bitIndex = 7; 179 | } 180 | } 181 | } 182 | row += inc; 183 | if (row < 0 || moduleCount <= row) { 184 | row -= inc; 185 | inc = -inc; 186 | break; 187 | } 188 | } 189 | } 190 | } 191 | 192 | // UInt 193 | static int _PAD0 = 0xEC; 194 | 195 | // UInt 196 | static int _PAD1 = 0x11; 197 | 198 | static List _createData( 199 | int typeNumber, QRErrorCorrectLevel errorCorrectLevel, QR8bitByte data) { 200 | List rsBlocks = errorCorrectLevel.getRSBlocksOfType(typeNumber); 201 | QRBitBuffer buffer = QRBitBuffer(); 202 | 203 | buffer.put(data.mode.rawValue, 4); 204 | int length = data.mode.bitCountOfType(typeNumber); 205 | buffer.put(data.count, length); 206 | data.writeTo(buffer); 207 | 208 | int totalDataCount = 0; 209 | for (int i = 0; i < rsBlocks.length; i++) { 210 | totalDataCount += rsBlocks[i].dataCount; 211 | } 212 | if (buffer.bitCount > totalDataCount * 8) { 213 | throw AnError( 214 | "code length overflow. (\(buffer.bitCount)>\(totalDataCount * 8))"); 215 | } 216 | if (buffer.bitCount + 4 <= totalDataCount * 8) { 217 | buffer.put(0, 4); 218 | } 219 | while (buffer.bitCount % 8 != 0) { 220 | buffer.putBit(false); 221 | } 222 | while (true) { 223 | if (buffer.bitCount >= totalDataCount * 8) { 224 | break; 225 | } 226 | buffer.put(QRCodeModel._PAD0, 8); 227 | if (buffer.bitCount >= totalDataCount * 8) { 228 | break; 229 | } 230 | buffer.put(QRCodeModel._PAD1, 8); 231 | } 232 | List bytes = QRCodeModel._createBytesFromBuffer(buffer, rsBlocks); 233 | return bytes; 234 | } 235 | 236 | static List _createBytesFromBuffer( 237 | QRBitBuffer buffer, List rsBlocks) { 238 | int offset = 0; 239 | int maxDcCount = 0; 240 | int maxEcCount = 0; 241 | // Actual contents will be assigned later 242 | List> dcdata = 243 | List>.filled(rsBlocks.length, [], growable: false); 244 | List> ecdata = 245 | List>.filled(rsBlocks.length, [], growable: false); 246 | for (int r = 0; r < rsBlocks.length; r++) { 247 | int dcCount = rsBlocks[r].dataCount; 248 | int ecCount = rsBlocks[r].totalCount - dcCount; 249 | maxDcCount = max(maxDcCount, dcCount); 250 | maxEcCount = max(maxEcCount, ecCount); 251 | dcdata[r] = List.filled(dcCount, 0, growable: false); 252 | for (int i = 0; i < dcCount; i++) { 253 | dcdata[r][i] = 0xff & buffer.buffer[i + offset]; 254 | } 255 | offset += dcCount; 256 | QRPolynomial rsPoly = 257 | QRPolynomial.errorCorrectPolynomialOfLength(ecCount); 258 | QRPolynomial rawPoly = QRPolynomial(dcdata[r], shift: rsPoly.count - 1); 259 | QRPolynomial modPoly = rawPoly.modedBy(rsPoly); 260 | ecdata[r] = List.filled(rsPoly.count - 1, 0, growable: false); 261 | for (int i = 0; i < ecdata[r].length; i++) { 262 | int modIndex = i + modPoly.count - ecdata[r].length; 263 | ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; 264 | } 265 | } 266 | int totalCodeCount = 0; 267 | for (int i = 0; i < rsBlocks.length; i++) { 268 | totalCodeCount += rsBlocks[i].totalCount; 269 | } 270 | List data = List.filled(totalCodeCount, 0, growable: false); 271 | int index = 0; 272 | for (int i = 0; i < maxDcCount; i++) { 273 | for (int r = 0; r < rsBlocks.length; r++) { 274 | if (i < dcdata[r].length) { 275 | data[index++] = dcdata[r][i]; 276 | } 277 | } 278 | } 279 | for (int i = 0; i < maxEcCount; i++) { 280 | for (int r = 0; r < rsBlocks.length; r++) { 281 | if (i < ecdata[r].length) { 282 | data[index++] = ecdata[r][i]; 283 | } 284 | } 285 | } 286 | return data; 287 | } 288 | } 289 | 290 | extension QRCodeModelExtension on QRCodeModel { 291 | QRMaskPattern _getBestMaskPattern() { 292 | int minLostPoint = 0; 293 | int pattern = 0; 294 | for (int i = 0; i < 8; ++i) { 295 | _makeImplIsTest(true, QRMaskPatternExtension.pattern(i)); 296 | int lostPoint = this.lostPoint(); 297 | if (i == 0 || minLostPoint > lostPoint) { 298 | minLostPoint = lostPoint; 299 | pattern = i; 300 | } 301 | } 302 | return QRMaskPatternExtension.pattern(pattern); 303 | } 304 | 305 | int lostPoint() { 306 | // TODO: Remove if needed 307 | // let moduleCount = self.moduleCount 308 | int lostPoint = 0; 309 | for (int row = 0; row < moduleCount; row++) { 310 | for (int col = 0; col < moduleCount; col++) { 311 | int sameCount = 0; 312 | bool dark = isDark(row, col); 313 | for (int r = -1; r <= 1; r++) { 314 | if (row + r < 0 || moduleCount <= row + r) { 315 | continue; 316 | } 317 | for (int c = -1; c <= 1; c++) { 318 | if (col + c < 0 || moduleCount <= col + c) { 319 | continue; 320 | } 321 | if (r == 0 && c == 0) { 322 | continue; 323 | } 324 | if (dark == isDark(row + r, col + c)) { 325 | sameCount += 1; 326 | } 327 | } 328 | } 329 | if (sameCount > 5) { 330 | lostPoint += (3 + sameCount - 5); 331 | } 332 | } 333 | } 334 | for (int row = 0; row < moduleCount - 1; row++) { 335 | for (int col = 0; col < moduleCount - 1; col++) { 336 | int count = 0; 337 | if (isDark(row, col)) { 338 | count += 1; 339 | } 340 | if (isDark(row + 1, col)) { 341 | count += 1; 342 | } 343 | if (isDark(row, col + 1)) { 344 | count += 1; 345 | } 346 | if (isDark(row + 1, col + 1)) { 347 | count += 1; 348 | } 349 | if (count == 0 || count == 4) { 350 | lostPoint += 3; 351 | } 352 | } 353 | } 354 | for (int row = 0; row < moduleCount; row++) { 355 | for (int col = 0; col < moduleCount - 6; col++) { 356 | if (isDark(row, col) && 357 | isLight(row, col + 1) && 358 | isDark(row, col + 2) && 359 | isDark(row, col + 3) && 360 | isDark(row, col + 4) && 361 | isLight(row, col + 5) && 362 | isDark(row, col + 6)) { 363 | lostPoint += 40; 364 | } 365 | if (isDark(col, row) && 366 | isLight(col + 1, row) && 367 | isDark(col + 2, row) && 368 | isDark(col + 3, row) && 369 | isDark(col + 4, row) && 370 | isLight(col + 5, row) && 371 | isDark(col + 6, row)) { 372 | lostPoint += 40; 373 | } 374 | } 375 | } 376 | int darkCount = 0; 377 | for (int col = 0; col < moduleCount; col++) { 378 | for (int row = 0; row < moduleCount; row++) { 379 | if (isDark(row, col)) { 380 | darkCount += 1; 381 | } 382 | } 383 | } 384 | int ratio = (100 * darkCount / moduleCount / moduleCount - 50).abs() ~/ 5; 385 | lostPoint += ratio * 10; 386 | return lostPoint; 387 | } 388 | } 389 | -------------------------------------------------------------------------------- /lib/qrcode_type.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert' show utf8; 2 | 3 | import 'an_error.dart'; 4 | import 'qr_error_correct_level.dart'; 5 | 6 | class QRCodeType { 7 | static const List> QRCodeLimitLength = [ 8 | [17, 14, 11, 7], 9 | [32, 26, 20, 14], 10 | [53, 42, 32, 24], 11 | [78, 62, 46, 34], 12 | [106, 84, 60, 44], 13 | [134, 106, 74, 58], 14 | [154, 122, 86, 64], 15 | [192, 152, 108, 84], 16 | [230, 180, 130, 98], 17 | [271, 213, 151, 119], 18 | [321, 251, 177, 137], 19 | [367, 287, 203, 155], 20 | [425, 331, 241, 177], 21 | [458, 362, 258, 194], 22 | [520, 412, 292, 220], 23 | [586, 450, 322, 250], 24 | [644, 504, 364, 280], 25 | [718, 560, 394, 310], 26 | [792, 624, 442, 338], 27 | [858, 666, 482, 382], 28 | [929, 711, 509, 403], 29 | [1003, 779, 565, 439], 30 | [1091, 857, 611, 461], 31 | [1171, 911, 661, 511], 32 | [1273, 997, 715, 535], 33 | [1367, 1059, 751, 593], 34 | [1465, 1125, 805, 625], 35 | [1528, 1190, 868, 658], 36 | [1628, 1264, 908, 698], 37 | [1732, 1370, 982, 742], 38 | [1840, 1452, 1030, 790], 39 | [1952, 1538, 1112, 842], 40 | [2068, 1628, 1168, 898], 41 | [2188, 1722, 1228, 958], 42 | [2303, 1809, 1283, 983], 43 | [2431, 1911, 1351, 1051], 44 | [2563, 1989, 1423, 1093], 45 | [2699, 2099, 1499, 1139], 46 | [2809, 2213, 1579, 1219], 47 | [2953, 2331, 1663, 1273] 48 | ]; 49 | } 50 | 51 | extension QRCodeTypeExtension on QRCodeType { 52 | /// Get the type by string length 53 | static int typeNumberOf(String text, QRErrorCorrectLevel errorCorrectLevel) { 54 | final textLength = utf8.encode(text).length; 55 | final maxTypeNumber = QRCodeType.QRCodeLimitLength.length; 56 | 57 | int type = 1; 58 | for (int i = 0; i < maxTypeNumber; i++) { 59 | int limit; 60 | switch (errorCorrectLevel) { 61 | case QRErrorCorrectLevel.L: 62 | limit = QRCodeType.QRCodeLimitLength[i][0]; 63 | break; 64 | case QRErrorCorrectLevel.M: 65 | limit = QRCodeType.QRCodeLimitLength[i][1]; 66 | break; 67 | case QRErrorCorrectLevel.Q: 68 | limit = QRCodeType.QRCodeLimitLength[i][2]; 69 | break; 70 | case QRErrorCorrectLevel.H: 71 | limit = QRCodeType.QRCodeLimitLength[i][3]; 72 | break; 73 | } 74 | 75 | if (textLength <= limit) { 76 | return type; 77 | } else { 78 | type += 1; 79 | } 80 | } 81 | throw AnError('Data length exceeds maximum.'); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/qrcoder.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'qr_error_correct_level.dart'; 5 | import 'qrcode.dart'; 6 | 7 | class Qrcoder { 8 | 9 | static Future>> generateQRCodeMatrix(String text, 10 | {Encoding encoding = utf8, 11 | QRErrorCorrectLevel errorCorrectLevel = QRErrorCorrectLevel.H, 12 | bool hasBorder = true}) async { 13 | QRCode generator = QRCode(text, 14 | encoding: encoding, 15 | errorCorrectLevel: errorCorrectLevel, 16 | hasBorder: hasBorder); 17 | return generator.imageCodes(); 18 | } 19 | 20 | static Future generateQRCodeMatrixStringFilledAndPatchedWith( 21 | String text, 22 | {Encoding encoding = utf8, 23 | QRErrorCorrectLevel errorCorrectLevel = QRErrorCorrectLevel.H, 24 | bool hasBorder = true, 25 | String black = '1', 26 | String white = '0'}) async { 27 | QRCode generator = QRCode(text, 28 | encoding: encoding, 29 | errorCorrectLevel: errorCorrectLevel, 30 | hasBorder: hasBorder); 31 | return generator.toStringFilledAndPatchedWith(black: black, white: white); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "7.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "0.39.17" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.6.0" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.4.2" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.0.0" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.3" 46 | cli_util: 47 | dependency: transitive 48 | description: 49 | name: cli_util 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.2.0" 53 | collection: 54 | dependency: transitive 55 | description: 56 | name: collection 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.14.13" 60 | convert: 61 | dependency: transitive 62 | description: 63 | name: convert 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.1.1" 67 | coverage: 68 | dependency: transitive 69 | description: 70 | name: coverage 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "0.14.1" 74 | crypto: 75 | dependency: transitive 76 | description: 77 | name: crypto 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "2.1.5" 81 | csslib: 82 | dependency: transitive 83 | description: 84 | name: csslib 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "0.16.2" 88 | glob: 89 | dependency: transitive 90 | description: 91 | name: glob 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "1.2.0" 95 | html: 96 | dependency: transitive 97 | description: 98 | name: html 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "0.14.0+3" 102 | http: 103 | dependency: transitive 104 | description: 105 | name: http 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "0.12.2" 109 | http_multi_server: 110 | dependency: transitive 111 | description: 112 | name: http_multi_server 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "2.2.0" 116 | http_parser: 117 | dependency: transitive 118 | description: 119 | name: http_parser 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "3.1.4" 123 | io: 124 | dependency: transitive 125 | description: 126 | name: io 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "0.3.4" 130 | js: 131 | dependency: transitive 132 | description: 133 | name: js 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "0.6.2" 137 | logging: 138 | dependency: transitive 139 | description: 140 | name: logging 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "0.11.4" 144 | matcher: 145 | dependency: transitive 146 | description: 147 | name: matcher 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "0.12.9" 151 | meta: 152 | dependency: transitive 153 | description: 154 | name: meta 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "1.2.3" 158 | mime: 159 | dependency: transitive 160 | description: 161 | name: mime 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "0.9.7" 165 | node_interop: 166 | dependency: transitive 167 | description: 168 | name: node_interop 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "1.1.1" 172 | node_io: 173 | dependency: transitive 174 | description: 175 | name: node_io 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "1.1.1" 179 | node_preamble: 180 | dependency: transitive 181 | description: 182 | name: node_preamble 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "1.4.12" 186 | package_config: 187 | dependency: transitive 188 | description: 189 | name: package_config 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "1.9.3" 193 | path: 194 | dependency: transitive 195 | description: 196 | name: path 197 | url: "https://pub.dartlang.org" 198 | source: hosted 199 | version: "1.7.0" 200 | pedantic: 201 | dependency: transitive 202 | description: 203 | name: pedantic 204 | url: "https://pub.dartlang.org" 205 | source: hosted 206 | version: "1.9.2" 207 | pool: 208 | dependency: transitive 209 | description: 210 | name: pool 211 | url: "https://pub.dartlang.org" 212 | source: hosted 213 | version: "1.4.0" 214 | pub_semver: 215 | dependency: transitive 216 | description: 217 | name: pub_semver 218 | url: "https://pub.dartlang.org" 219 | source: hosted 220 | version: "1.4.4" 221 | shelf: 222 | dependency: transitive 223 | description: 224 | name: shelf 225 | url: "https://pub.dartlang.org" 226 | source: hosted 227 | version: "0.7.9" 228 | shelf_packages_handler: 229 | dependency: transitive 230 | description: 231 | name: shelf_packages_handler 232 | url: "https://pub.dartlang.org" 233 | source: hosted 234 | version: "2.0.0" 235 | shelf_static: 236 | dependency: transitive 237 | description: 238 | name: shelf_static 239 | url: "https://pub.dartlang.org" 240 | source: hosted 241 | version: "0.2.8" 242 | shelf_web_socket: 243 | dependency: transitive 244 | description: 245 | name: shelf_web_socket 246 | url: "https://pub.dartlang.org" 247 | source: hosted 248 | version: "0.2.3" 249 | source_map_stack_trace: 250 | dependency: transitive 251 | description: 252 | name: source_map_stack_trace 253 | url: "https://pub.dartlang.org" 254 | source: hosted 255 | version: "2.0.0" 256 | source_maps: 257 | dependency: transitive 258 | description: 259 | name: source_maps 260 | url: "https://pub.dartlang.org" 261 | source: hosted 262 | version: "0.10.9" 263 | source_span: 264 | dependency: transitive 265 | description: 266 | name: source_span 267 | url: "https://pub.dartlang.org" 268 | source: hosted 269 | version: "1.7.0" 270 | stack_trace: 271 | dependency: transitive 272 | description: 273 | name: stack_trace 274 | url: "https://pub.dartlang.org" 275 | source: hosted 276 | version: "1.9.5" 277 | stream_channel: 278 | dependency: transitive 279 | description: 280 | name: stream_channel 281 | url: "https://pub.dartlang.org" 282 | source: hosted 283 | version: "2.0.0" 284 | string_scanner: 285 | dependency: transitive 286 | description: 287 | name: string_scanner 288 | url: "https://pub.dartlang.org" 289 | source: hosted 290 | version: "1.0.5" 291 | term_glyph: 292 | dependency: transitive 293 | description: 294 | name: term_glyph 295 | url: "https://pub.dartlang.org" 296 | source: hosted 297 | version: "1.1.0" 298 | test: 299 | dependency: "direct dev" 300 | description: 301 | name: test 302 | url: "https://pub.dartlang.org" 303 | source: hosted 304 | version: "1.15.3" 305 | test_api: 306 | dependency: transitive 307 | description: 308 | name: test_api 309 | url: "https://pub.dartlang.org" 310 | source: hosted 311 | version: "0.2.18" 312 | test_core: 313 | dependency: transitive 314 | description: 315 | name: test_core 316 | url: "https://pub.dartlang.org" 317 | source: hosted 318 | version: "0.3.11" 319 | typed_data: 320 | dependency: transitive 321 | description: 322 | name: typed_data 323 | url: "https://pub.dartlang.org" 324 | source: hosted 325 | version: "1.2.0" 326 | vm_service: 327 | dependency: transitive 328 | description: 329 | name: vm_service 330 | url: "https://pub.dartlang.org" 331 | source: hosted 332 | version: "4.2.0" 333 | watcher: 334 | dependency: transitive 335 | description: 336 | name: watcher 337 | url: "https://pub.dartlang.org" 338 | source: hosted 339 | version: "0.9.7+15" 340 | web_socket_channel: 341 | dependency: transitive 342 | description: 343 | name: web_socket_channel 344 | url: "https://pub.dartlang.org" 345 | source: hosted 346 | version: "1.1.0" 347 | webkit_inspection_protocol: 348 | dependency: transitive 349 | description: 350 | name: webkit_inspection_protocol 351 | url: "https://pub.dartlang.org" 352 | source: hosted 353 | version: "0.7.3" 354 | yaml: 355 | dependency: transitive 356 | description: 357 | name: yaml 358 | url: "https://pub.dartlang.org" 359 | source: hosted 360 | version: "2.2.1" 361 | sdks: 362 | dart: ">=2.7.0 <3.0.0" 363 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: qrcoder 2 | description: Yet another stupid dart qrcode plugin. 3 | version: 0.2.0 4 | author: EyreFree 5 | homepage: https://github.com/EyreFree/qrcoder 6 | 7 | environment: 8 | sdk: ">=2.7.0 <3.0.0" 9 | 10 | dev_dependencies: 11 | test: ^1.15.3 -------------------------------------------------------------------------------- /qrcoder.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/qrcoder_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:qrcoder/qrcoder.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | 6 | test('2333', () async { 7 | expect( 8 | await Qrcoder.generateQRCodeMatrixStringFilledAndPatchedWith('2333', hasBorder: false), 9 | ''' 10 | 111111100110001111111 11 | 100000100100101000001 12 | 101110100100101011101 13 | 101110100001101011101 14 | 101110101111101011101 15 | 100000100011101000001 16 | 111111101010101111111 17 | 000000001010100000000 18 | 001100111100011010000 19 | 011011010111110100111 20 | 011010101111110110101 21 | 101110000111000000011 22 | 110000110011000011000 23 | 000000001100100101010 24 | 111111101110100011110 25 | 100000100101010000100 26 | 101110100101110000111 27 | 101110101101001010010 28 | 101110101001000011000 29 | 100000100101011011001 30 | 111111100100111100000 31 | ''' 32 | ); 33 | }); 34 | } 35 | --------------------------------------------------------------------------------