diff --git a/GoogleService-Info.plist b/GoogleService-Info.plist
deleted file mode 100644
index 0c093a2a..00000000
--- a/GoogleService-Info.plist
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- CLIENT_ID
- 864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r.apps.googleusercontent.com
- REVERSED_CLIENT_ID
- com.googleusercontent.apps.864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r
- API_KEY
- AIzaSyA_6ayGCk4fly7o7eTVBrj9kuHBYHMAOfs
- GCM_SENDER_ID
- 864393916058
- PLIST_VERSION
- 1
- BUNDLE_ID
- com.cloud.diplomaticquarterapp
- PROJECT_ID
- diplomaticquarter-d2385
- STORAGE_BUCKET
- diplomaticquarter-d2385.appspot.com
- IS_ADS_ENABLED
-
- IS_ANALYTICS_ENABLED
-
- IS_APPINVITE_ENABLED
-
- IS_GCM_ENABLED
-
- IS_SIGNIN_ENABLED
-
- GOOGLE_APP_ID
- 1:864393916058:ios:13f787bbfe6051f8b97923
- DATABASE_URL
- https://diplomaticquarter-d2385.firebaseio.com
-
-
\ No newline at end of file
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 11e99a2a..336e8e53 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -39,7 +39,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.cloud.diplomaticquarterapp"
+// applicationId "com.cloud.diplomaticquarterapp"
+ applicationId "com.ejada.hmg.uat"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
diff --git a/android/app/google-services.json b/android/app/google-services.json
index a4655794..6d1d75a9 100644
--- a/android/app/google-services.json
+++ b/android/app/google-services.json
@@ -1,37 +1,39 @@
{
"project_info": {
- "project_number": "864393916058",
- "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com",
- "project_id": "diplomaticquarter-d2385",
- "storage_bucket": "diplomaticquarter-d2385.appspot.com"
+ "project_number": "815750722565",
+ "firebase_url": "https://api-project-815750722565.firebaseio.com",
+ "project_id": "api-project-815750722565",
+ "storage_bucket": "api-project-815750722565.appspot.com"
},
"client": [
{
"client_info": {
- "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923",
+ "mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063",
"android_client_info": {
- "package_name": "com.cloud.diplomaticquarterapp"
+ "package_name": "com.ejada.hmg.uat"
}
},
"oauth_client": [
{
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
+ "client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
- "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM"
+ "current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw"
}
],
"services": {
+ "analytics_service": {
+ "status": 1
+ },
"appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
+ "status": 1,
+ "other_platform_oauth_client": []
+ },
+ "ads_service": {
+ "status": 2
}
}
}
diff --git a/android/app/gradle/wrapper/gradle-wrapper.properties b/android/app/gradle/wrapper/gradle-wrapper.properties
index 8fc3bbec..a2c20300 100644
--- a/android/app/gradle/wrapper/gradle-wrapper.properties
+++ b/android/app/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
+#distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 1a3d4cfe..63f94294 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,6 +5,7 @@
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
+
@@ -29,12 +30,16 @@
-
+
+
+
+
+
+ android:label="Dr. Alhabib">
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db77bb4b..348b5116 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 17987b79..410b1b1e 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 09d43914..bb9943af 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index d5f1c8d3..0b9d9359 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 4d6372ee..aaa9808d 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/build.gradle b/android/build.gradle
index 32bda0b1..c0fc03b3 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -9,16 +9,17 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.1'
+ classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.google.gms:google-services:4.3.4'
+ classpath 'com.google.gms:google-services:4.3.8'
}
}
allprojects {
repositories {
google()
- jcenter()
+// jcenter()
+ mavenCentral()
}
}
diff --git a/android/google-services.json b/android/google-services.json
index a4655794..dd4038cf 100644
--- a/android/google-services.json
+++ b/android/google-services.json
@@ -1,37 +1,39 @@
{
"project_info": {
- "project_number": "864393916058",
- "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com",
- "project_id": "diplomaticquarter-d2385",
- "storage_bucket": "diplomaticquarter-d2385.appspot.com"
+ "project_number": "815750722565",
+ "firebase_url": "https://api-project-815750722565.firebaseio.com",
+ "project_id": "api-project-815750722565",
+ "storage_bucket": "api-project-815750722565.appspot.com"
},
"client": [
{
"client_info": {
- "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923",
+ "mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063",
"android_client_info": {
- "package_name": "com.cloud.diplomaticquarterapp"
+ "package_name": "com.ejada.hmg"
}
},
"oauth_client": [
{
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
+ "client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
- "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM"
+ "current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw"
}
],
"services": {
+ "analytics_service": {
+ "status": 1
+ },
"appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
+ "status": 1,
+ "other_platform_oauth_client": []
+ },
+ "ads_service": {
+ "status": 2
}
}
}
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 1f9de82f..6fdb0e44 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Sep 03 16:26:30 EEST 2020
+#Wed Jul 14 15:55:18 AST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
diff --git a/google-services.json b/google-services.json
deleted file mode 100644
index a4655794..00000000
--- a/google-services.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "project_info": {
- "project_number": "864393916058",
- "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com",
- "project_id": "diplomaticquarter-d2385",
- "storage_bucket": "diplomaticquarter-d2385.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923",
- "android_client_info": {
- "package_name": "com.cloud.diplomaticquarterapp"
- }
- },
- "oauth_client": [
- {
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM"
- }
- ],
- "services": {
- "appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
- }
- }
- }
- ],
- "configuration_version": "1"
-}
\ No newline at end of file
diff --git a/ios/Podfile b/ios/Podfile
index d68afba2..89424e2a 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -3,6 +3,7 @@
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+$FirebaseAnalyticsWithoutAdIdSupport = true
project 'Runner', {
'Debug' => :debug,
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
index 28c6bf03..0e65243a 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
index 2ccbfd96..2e4c7963 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
index f091b6b0..59435c76 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
index 4cde1211..20855aad 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
index d0ef06e7..11d35da4 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
index dcdc2306..93523cbe 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
index 2ccbfd96..2e4c7963 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
index c8f9ed8f..00bb8dbd 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
index a6d6b860..3eaa1fb6 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
index a6d6b860..3eaa1fb6 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
index 75b2d164..fd80aa41 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
index c4df70d3..39c7958d 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
index 6a84f41e..47a96a43 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
index d0e1f585..8c4ca7b0 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist
index 0c093a2a..633037cb 100644
--- a/ios/Runner/GoogleService-Info.plist
+++ b/ios/Runner/GoogleService-Info.plist
@@ -3,21 +3,23 @@
CLIENT_ID
- 864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r.apps.googleusercontent.com
+ 815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt.apps.googleusercontent.com
REVERSED_CLIENT_ID
- com.googleusercontent.apps.864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r
+ com.googleusercontent.apps.815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt
+ ANDROID_CLIENT_ID
+ 815750722565-m14h8mkosm7cnq6uh6rhqr54dn02d705.apps.googleusercontent.com
API_KEY
- AIzaSyA_6ayGCk4fly7o7eTVBrj9kuHBYHMAOfs
+ AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA
GCM_SENDER_ID
- 864393916058
+ 815750722565
PLIST_VERSION
1
BUNDLE_ID
- com.cloud.diplomaticquarterapp
+ com.HMG.HMG-Smartphone
PROJECT_ID
- diplomaticquarter-d2385
+ api-project-815750722565
STORAGE_BUCKET
- diplomaticquarter-d2385.appspot.com
+ api-project-815750722565.appspot.com
IS_ADS_ENABLED
IS_ANALYTICS_ENABLED
@@ -29,8 +31,8 @@
IS_SIGNIN_ENABLED
GOOGLE_APP_ID
- 1:864393916058:ios:13f787bbfe6051f8b97923
+ 1:815750722565:ios:328ec247a81a2ca23c186c
DATABASE_URL
- https://diplomaticquarter-d2385.firebaseio.com
+ https://api-project-815750722565.firebaseio.com
\ No newline at end of file
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index ae084167..72bd4ac9 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -11,7 +11,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleName
- diplomaticquarterapp
+ Dr. Alhabib
CFBundlePackageType
APPL
CFBundleShortVersionString
diff --git a/speech_to_text/android/build.gradle b/speech_to_text/android/build.gradle
index 6b23b300..cc06ea57 100644
--- a/speech_to_text/android/build.gradle
+++ b/speech_to_text/android/build.gradle
@@ -31,7 +31,7 @@ android {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
- minSdkVersion 21
+ minSdkVersion 18
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
diff --git a/speech_to_text/android/gradle/local.properties b/speech_to_text/android/gradle/local.properties
index 71a0a2e4..b85628e7 100644
--- a/speech_to_text/android/gradle/local.properties
+++ b/speech_to_text/android/gradle/local.properties
@@ -1,3 +1,2 @@
sdk.dir=/Users/stephen.owens/Library/Android/sdk
-flutter.sdk=/Users/stephen.owens/Documents/dev/flutter/sdk/flutter
-org.gradle.jvmargs=-Xmx1536m -Duser.country=US -Duser.language=en
\ No newline at end of file
+flutter.sdk=/Users/stephen.owens/Documents/dev/flutter/sdk/flutter
\ No newline at end of file
diff --git a/speech_to_text/example/android/app/build.gradle b/speech_to_text/example/android/app/build.gradle
index 8b616f29..104069d3 100644
--- a/speech_to_text/example/android/app/build.gradle
+++ b/speech_to_text/example/android/app/build.gradle
@@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.csdcorp.speech_to_text_example"
- minSdkVersion 21
+ minSdkVersion 18
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/speech_to_text_/.github/workflows/master.yml b/speech_to_text_/.github/workflows/master.yml
new file mode 100644
index 00000000..4d4cff1c
--- /dev/null
+++ b/speech_to_text_/.github/workflows/master.yml
@@ -0,0 +1,19 @@
+name: build
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ test:
+ name: Test on Ubuntu
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - uses: subosito/flutter-action@v1.3.2
+ with:
+ flutter-version: '1.17.1'
+ channel: 'stable'
+ - run: flutter pub get
+ - run: flutter test
diff --git a/speech_to_text_/.gitignore b/speech_to_text_/.gitignore
new file mode 100644
index 00000000..8969cbcd
--- /dev/null
+++ b/speech_to_text_/.gitignore
@@ -0,0 +1,11 @@
+.DS_Store
+.dart_tool/
+
+.packages
+.pub/
+
+build/
+coverage/
+example/.flutter-plugins-dependencies
+**/ios/Flutter/flutter_export_environment.sh
+android/.idea/
diff --git a/speech_to_text_/.metadata b/speech_to_text_/.metadata
new file mode 100644
index 00000000..1940d996
--- /dev/null
+++ b/speech_to_text_/.metadata
@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f
+ channel: stable
+
+project_type: plugin
diff --git a/speech_to_text_/CHANGELOG.md b/speech_to_text_/CHANGELOG.md
new file mode 100644
index 00000000..477e110c
--- /dev/null
+++ b/speech_to_text_/CHANGELOG.md
@@ -0,0 +1,166 @@
+# Changelog
+
+## 2.3.0
+
+### New
+ * new parameter `onDevice` on the `listen` method enforces on device recognition for sensitive content
+ * onSoundLevelChange now supported on iOS
+ * added compile troubleshooting help to README.md
+ * `SpeechToTextProvider` is an alternate and simpler way to interact with the `SpeechToText` plugin.
+ * new `provider_example.dart` example for usage of `SpeechToTextProvider`.
+### Fix
+ * on iOS handles some conflicts with other applications better to keep speech working after calls for example
+
+
+## 2.2.0
+
+### New
+ * improved error handling and logging in the iOS implementation
+ * added general guides for iOS to the README
+ * moved stress testing out of the main example
+ * iOS now defaults to using the speaker rather than the receiver for start /stop sounds when no headphones
+### Fix
+ * iOS now properly deactivates the audio session when no longer listening
+ * start and stop sounds on iOS should be more reliable when available
+
+## 2.1.0
+### Breaking
+ * `listenFor` now calls `stop` rather than `cancel` as this seems like more useful behaviour
+
+### Fix
+ * Android no longer stops or cancels the speech recognizer if it has already been shutdown by a
+ timeout or other platform behaviour.
+ * Android no longer tries to restart the listener when it is already active
+ * Now properly notifies errors that happen after listening stops due to platform callback rather than
+ client request. See https://github.com/csdcorp/speech_to_text/issues/51
+
+## 2.0.1
+### Fix
+ * Resolves an issue with the Android implementation not handling permission requests properly on apps
+ that didn't use the 1.12.x plugin APIs for registration. The permission dialog would not appear and
+ permission was denied.
+
+
+## 2.0.0
+
+### Breaking
+
+ * Upgraded to New Swift 1.12 plugin structure, may work with older Flutter version but not guaranteed
+
+### New
+
+ * the plugin now requests both speech and microphone permission on initialize on iOS
+ * added `debugLogging` parameter to the `initialize` method to control native logging
+
+### Fix
+
+ * The Android implementation now blocks duplicate results notifications. It appears that at least on some
+ Android versions the final results notification onResults is notified twice when Android automatically
+ terminates the session due to a pause time. The de-duplication looks for successive notifications
+ with < 100 ms between them and blocks the second. If you miss any onResult notifications please post
+ an issue.
+
+## 1.1.0
+
+### New
+
+ * error_timeout has been separated into error_network_timeout and error_speech_timeout
+
+## 1.0.0
+
+### New
+ * hasPermission to check for the current permission without bringing up the system dialog
+ * `listen` has a new optional `cancelOnError` parameter to support automatically canceling
+ a listening session on a permanent error.
+ * `listen` has a new optional `partialResults` parameter that controls whether the callback
+ receives partial or only final results.
+
+## 0.8.0
+
+### New
+
+ * speech recognizer now exposes multiple possible transcriptions for each recognized speech
+ * alternates list on SpeechRecognitionResult exposes alternate transcriptions of voice
+ * confidence on SpeechRecognitionResult gives an estimate of confidence in the transcription
+ * isConfident on SpeechRecognitionResult supports testing confidence
+ * hasConfidenceRating on SpeechRecognitionResult indicates if confidence was provided from the device
+ * new SpeechRecognitionWords class gives details on per transcription words and confidence
+
+### Fix
+
+ * speechRecognizer availabilityDidChange was crashing if invoked due to an invalid parameter type
+ * Added iOS platform 10 to example Podfile to resolve compilation warnings
+
+## 0.7.2
+
+### Breaking
+
+ * Upgrade Swift to version 5 to match Flutter. Projects using this plugin must now switch to 5.
+
+## 0.7.1
+
+### Fix
+
+ * Upgrade Kotlin to 1.3.5 to match the Flutter 1.12 version
+ * Upgrade Gradle build to 3.5.0 to match the Flutter 1.12 version
+ * Android version of the plugin was repeating the system default locale in the `locales` list
+
+## 0.7.0
+
+### New
+
+ * locales method returns the list of available languages for speech
+ * new optional localeId parameter on listen method supports choosing the comprehension language separately from the current system locale.
+
+### Breaking
+
+ * `cancel` and `stop` are now async
+
+## 0.6.3
+
+### Fix
+
+ * request permission fix on Android to ensure it doesn't conflict with other requests
+
+## 0.6.2
+
+### Fix
+
+ * channel invoke wasn't being done on the main thread in iOS
+
+## 0.6.1
+
+### Fix
+
+ * listening sound was failing due to timing, now uses play and record mode on iOS.
+
+ ## 0.6.0
+### Breaking
+
+ * The filenames for the optional sounds for iOS have changed.
+
+### New
+
+ * Added an optional listenFor parameter to set a max duration to listen for speech and then automatically cancel.
+
+### Fix
+
+ * Was failing to play sounds because of record mode. Now plays sounds before going into record mode and after coming out.
+ * Status listener was being ignored, now properly notifies on status changes.
+
+## 0.5.1
+ * Fixes a problem where the recognizer left the AVAudioSession in record mode which meant that subsequent sounds couldn't be played.
+
+## 0.5.0
+Initial draft with limited functionality, supports:
+ * initializing speech recognition
+ * asking the user for permission if required
+ * listening for recognized speech
+ * canceling the current recognition session
+ * stopping the current recognition session
+* Android and iOS 10+ support
+
+Missing:
+ * some error handling
+ * testing across multiple OS versions
+ * and more, to be discovered...
diff --git a/speech_to_text_/LICENSE b/speech_to_text_/LICENSE
new file mode 100644
index 00000000..7c3991c8
--- /dev/null
+++ b/speech_to_text_/LICENSE
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2019, Corner Software Development Corp.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/speech_to_text_/README.md b/speech_to_text_/README.md
new file mode 100644
index 00000000..af726f0e
--- /dev/null
+++ b/speech_to_text_/README.md
@@ -0,0 +1,150 @@
+# speech_to_text
+
+[](https://pub.dartlang.org/packages/speech_to_text) [](https://github.com/csdcorp/speech_to_text/actions?query=workflow%3Abuild)
+
+A library that exposes device specific speech recognition capability.
+
+This plugin contains a set of classes that make it easy to use the speech recognition
+capabilities of the mobile device in Flutter. It supports both Android and iOS. The
+target use cases for this library are commands and short phrases, not continuous spoken
+conversion or always on listening.
+
+## Recent Updates
+
+The 2.3.0 version adds `SpeechToTextProvider` as a simpler way to interact with the plugin. Checkout
+the new `provider_example.dart` for intended usage.
+
+The 2.2.0 version improves audio session handling and start / stop sound playback on iOS.
+
+*Note*: Feedback from any test devices is welcome.
+
+## Using
+
+To recognize text from the microphone import the package and call the plugin, like so:
+
+```dart
+import 'package:speech_to_text/speech_to_text.dart' as stt;
+
+ stt.SpeechToText speech = stt.SpeechToText();
+ bool available = await speech.initialize( onStatus: statusListener, onError: errorListener );
+ if ( available ) {
+ speech.listen( onResult: resultListener );
+ }
+ else {
+ print("The user has denied the use of speech recognition.");
+ }
+ // some time later...
+ speech.stop()
+```
+
+### Initialize once
+The `initialize` method only needs to be called once per application session. After that `listen`,
+`start`, `stop`, and `cancel` can be used to interact with the plugin. Subsequent calls to `initialize`
+are ignored which is safe but does mean that the `onStatus` and `onError` callbacks cannot be reset after
+the first call to `initialize`. For that reason there should be only one instance of the plugin per
+application. The `SpeechToTextProvider` is one way to create a single instance and easily reuse it in
+multiple widgets.
+
+## Permissions
+
+Applications using this plugin require user permissions.
+### iOS
+
+Add the following keys to your _Info.plist_ file, located in `/ios/Runner/Info.plist`:
+
+* `NSSpeechRecognitionUsageDescription` - describe why your app uses speech recognition. This is called _Privacy - Speech Recognition Usage Description_ in the visual editor.
+* `NSMicrophoneUsageDescription` - describe why your app needs access to the microphone. This is called _Privacy - Microphone Usage Description_ in the visual editor.
+
+### Android
+
+Add the record audio permission to your _AndroidManifest.xml_ file, located in `/android/app/src/main/AndroidManifest.xml`.
+
+* `android.permission.RECORD_AUDIO` - this permission is required for microphone access.
+* `android.permission.INTERNET` - this permission is required because speech recognition may use remote services.
+
+## Adding Sounds for iOS (optional)
+
+Android automatically plays system sounds when speech listening starts or stops but iOS does not. This plugin supports playing sounds to indicate listening status on iOS if sound files are available as assets in the application. To enable sounds in an application using this plugin add the sound files to the project and reference them in the assets section of the application `pubspec.yaml`. The location and filenames of the sound files must exactly match what
+is shown below or they will not be found. The example application for the plugin shows the usage. *Note* These files should be very short as they delay
+the start / end of the speech recognizer until the sound playback is complete.
+```yaml
+ assets:
+ - assets/sounds/speech_to_text_listening.m4r
+ - assets/sounds/speech_to_text_cancel.m4r
+ - assets/sounds/speech_to_text_stop.m4r
+```
+* `speech_to_text_listening.m4r` - played when the listen method is called.
+* `speech_to_text_cancel.m4r` - played when the cancel method is called.
+* `speech_to_text_stop.m4r` - played when the stop method is called.
+
+## Troubleshooting
+
+### SDK version error trying to compile for Android
+```
+Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:speech_to_text]
+```
+The speech_to_text plugin requires at least Android SDK 21 because some of the speech functions in Android
+were only introduced in that version. To fix this error you need to change the `build.gradle` entry to reflect
+this version. Here's what the relevant part of that file looked like as of this writing:
+```
+ defaultConfig {
+ applicationId "com.example.app"
+ minSdkVersion 21
+ targetSdkVersion 28
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+```
+
+### Incorrect Swift version trying to compile for iOS
+```
+/Users/markvandergon/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-1.1.0/ios/Classes/SwiftSpeechToTextPlugin.swift:224:44: error: value of type 'SwiftSpeechToTextPlugin' has no member 'AVAudioSession'
+ rememberedAudioCategory = self.AVAudioSession.Category
+ ~~~~ ^~~~~~~~~~~~~~
+ /Users/markvandergon/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-1.1.0/ios/Classes/SwiftSpeechToTextPlugin.swift:227:63: error: type 'Int' has no member 'notifyOthersOnDeactivation'
+ try self.audioSession.setActive(true, withFlags: .notifyOthersOnDeactivation)
+```
+This happens when the Swift language version is not set correctly. See this thread for help https://github.com/csdcorp/speech_to_text/issues/45.
+
+### Swift not supported trying to compile for iOS
+```
+`speech_to_text` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set.
+```
+This usually happens for older projects that only support Objective-C. See this thread for help https://github.com/csdcorp/speech_to_text/issues/88.
+
+### Not working on a particular Android device
+The symptom for this issue is that the `initialize` method will always fail. If you turn on debug logging
+using the `debugLogging: true` flag on the `initialize` method you'll see `'Speech recognition unavailable'`
+in the Android log. There's a lengthy issue discussion here https://github.com/csdcorp/speech_to_text/issues/36
+about this. The issue seems to be that the recognizer is not always automatically enabled on the device. Two
+key things helped resolve the issue in this case at least.
+
+#### First
+1. Go to Google Play
+2. Search for 'Google'
+3. You should find this app: https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox
+If 'Disabled' enable it
+
+This is the SO post that helped: https://stackoverflow.com/questions/28769320/how-to-check-wether-speech-recognition-is-available-or-not
+
+#### Second
+Ensure the app has the required permissions. The symptom for this that you get a permanent error notification
+ 'error_audio_error` when starting a listen session. Here's a Stack Overflow post that addresses that
+ https://stackoverflow.com/questions/46376193/android-speechrecognizer-audio-recording-error
+ Here's the important excerpt:
+ >You should go to system setting, Apps, Google app, then enable its permission of microphone.
+
+### iOS recognition guidelines
+Apple has quite a good guide on the user experience for using speech, the original is here
+https://developer.apple.com/documentation/speech/sfspeechrecognizer This is the section that I think is particularly relevant:
+
+>#### Create a Great User Experience for Speech Recognition
+>Here are some tips to consider when adding speech recognition support to your app.
+
+>**Be prepared to handle failures caused by speech recognition limits.** Because speech recognition is a network-based service, limits are enforced so that the service can remain freely available to all apps. Individual devices may be limited in the number of recognitions that can be performed per day, and each app may be throttled globally based on the number of requests it makes per day. If a recognition request fails quickly (within a second or two of starting), check to see if the recognition service became unavailable. If it is, you may want to ask users to try again later.
+
+>**Plan for a one-minute limit on audio duration.** Speech recognition places a relatively high burden on battery life and network usage. To minimize this burden, the framework stops speech recognition tasks that last longer than one minute. This limit is similar to the one for keyboard-related dictation.
+Remind the user when your app is recording. For example, display a visual indicator and play sounds at the beginning and end of speech recognition to help users understand that they're being actively recorded. You can also display speech as it is being recognized so that users understand what your app is doing and see any mistakes made during the recognition process.
+
+>**Do not perform speech recognition on private or sensitive information.** Some speech is not appropriate for recognition. Don't send passwords, health or financial data, and other sensitive speech for recognition.
diff --git a/speech_to_text_/android/.classpath b/speech_to_text_/android/.classpath
new file mode 100644
index 00000000..eb19361b
--- /dev/null
+++ b/speech_to_text_/android/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/speech_to_text_/android/.gitignore b/speech_to_text_/android/.gitignore
new file mode 100644
index 00000000..c6cbe562
--- /dev/null
+++ b/speech_to_text_/android/.gitignore
@@ -0,0 +1,8 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/speech_to_text_/android/.project b/speech_to_text_/android/.project
new file mode 100644
index 00000000..3050653c
--- /dev/null
+++ b/speech_to_text_/android/.project
@@ -0,0 +1,23 @@
+
+
+ speech_to_text
+ Project android_____ created by Buildship.
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/speech_to_text_/android/.settings/org.eclipse.buildship.core.prefs b/speech_to_text_/android/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 00000000..7a23d112
--- /dev/null
+++ b/speech_to_text_/android/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(5.6.1))
+connection.project.dir=
+eclipse.preferences.version=1
+gradle.user.home=
+java.home=
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true
diff --git a/speech_to_text_/android/build.gradle b/speech_to_text_/android/build.gradle
new file mode 100644
index 00000000..6b23b300
--- /dev/null
+++ b/speech_to_text_/android/build.gradle
@@ -0,0 +1,44 @@
+group 'com.csdcorp.speech_to_text'
+version '1.0-SNAPSHOT'
+
+buildscript {
+ ext.kotlin_version = '1.3.50'
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+rootProject.allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+
+android {
+ compileSdkVersion 28
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+ defaultConfig {
+ minSdkVersion 21
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ lintOptions {
+ disable 'InvalidPackage'
+ }
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+}
diff --git a/speech_to_text_/android/gradle/gradle.properties b/speech_to_text_/android/gradle/gradle.properties
new file mode 100644
index 00000000..94adc3a3
--- /dev/null
+++ b/speech_to_text_/android/gradle/gradle.properties
@@ -0,0 +1,3 @@
+org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/speech_to_text_/android/gradle/local.properties b/speech_to_text_/android/gradle/local.properties
new file mode 100644
index 00000000..71a0a2e4
--- /dev/null
+++ b/speech_to_text_/android/gradle/local.properties
@@ -0,0 +1,3 @@
+sdk.dir=/Users/stephen.owens/Library/Android/sdk
+flutter.sdk=/Users/stephen.owens/Documents/dev/flutter/sdk/flutter
+org.gradle.jvmargs=-Xmx1536m -Duser.country=US -Duser.language=en
\ No newline at end of file
diff --git a/speech_to_text_/android/gradle/settings.gradle b/speech_to_text_/android/gradle/settings.gradle
new file mode 100644
index 00000000..cdfc1c4b
--- /dev/null
+++ b/speech_to_text_/android/gradle/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'speech_to_text'
diff --git a/speech_to_text_/android/gradle/wrapper/gradle-wrapper.properties b/speech_to_text_/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..674bdda0
--- /dev/null
+++ b/speech_to_text_/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/speech_to_text_/android/src/main/AndroidManifest.xml b/speech_to_text_/android/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..61a73f32
--- /dev/null
+++ b/speech_to_text_/android/src/main/AndroidManifest.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/speech_to_text_/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt b/speech_to_text_/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt
new file mode 100644
index 00000000..7954add3
--- /dev/null
+++ b/speech_to_text_/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt
@@ -0,0 +1,595 @@
+package com.csdcorp.speech_to_text
+
+import androidx.annotation.NonNull;
+import io.flutter.embedding.engine.plugins.FlutterPlugin
+import android.Manifest
+import android.annotation.TargetApi
+import android.app.Activity
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.os.Build
+import android.os.Bundle
+import android.speech.RecognitionListener
+import android.speech.SpeechRecognizer.createSpeechRecognizer
+import android.speech.RecognizerIntent
+import android.speech.SpeechRecognizer
+import androidx.core.app.ActivityCompat
+import androidx.core.content.ContextCompat
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+import io.flutter.plugin.common.MethodChannel.MethodCallHandler
+import io.flutter.plugin.common.MethodChannel.Result
+import io.flutter.plugin.common.PluginRegistry
+import io.flutter.plugin.common.PluginRegistry.Registrar
+import org.json.JSONObject
+import android.content.Context
+import android.content.BroadcastReceiver
+import android.os.Handler
+import android.os.Looper
+import android.util.Log
+import io.flutter.embedding.engine.plugins.activity.ActivityAware
+import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
+import io.flutter.plugin.common.BinaryMessenger
+import org.json.JSONArray
+import java.util.*
+
+
+enum class SpeechToTextErrors {
+ multipleRequests,
+ unimplemented,
+ noLanguageIntent,
+ recognizerNotAvailable,
+ missingOrInvalidArg,
+ unknown
+}
+
+enum class SpeechToTextCallbackMethods {
+ textRecognition,
+ notifyStatus,
+ notifyError,
+ soundLevelChange,
+}
+
+enum class SpeechToTextStatus {
+ listening,
+ notListening,
+ unavailable,
+ available,
+}
+
+enum class ListenMode {
+ deviceDefault,
+ dictation,
+ search,
+ confirmation,
+}
+
+const val pluginChannelName = "plugin.csdcorp.com/speech_to_text"
+
+@TargetApi(8)
+/** SpeechToTextPlugin */
+public class SpeechToTextPlugin :
+ MethodCallHandler, RecognitionListener,
+ PluginRegistry.RequestPermissionsResultListener, FlutterPlugin,
+ ActivityAware {
+ private var pluginContext: Context? = null
+ private var channel: MethodChannel? = null
+ private val minSdkForSpeechSupport = 21
+ private val speechToTextPermissionCode = 28521
+ private val missingConfidence: Double = -1.0
+ private val logTag = "SpeechToTextPlugin"
+ private var currentActivity: Activity? = null
+ private var activeResult: Result? = null
+ private var initializedSuccessfully: Boolean = false
+ private var permissionToRecordAudio: Boolean = false
+ private var listening = false
+ private var debugLogging: Boolean = false
+ private var speechRecognizer: SpeechRecognizer? = null
+ private var recognizerIntent: Intent? = null
+ private var previousRecognizerLang: String? = null
+ private var previousPartialResults: Boolean = true
+ private var previousListenMode: ListenMode = ListenMode.deviceDefault
+ private var lastFinalTime: Long = 0
+ private val handler: Handler = Handler(Looper.getMainLooper())
+ private val defaultLanguageTag: String = Locale.getDefault().toLanguageTag()
+
+ override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
+
+ onAttachedToEngine(flutterPluginBinding.getApplicationContext(), flutterPluginBinding.getBinaryMessenger());
+ }
+
+ // This static function is optional and equivalent to onAttachedToEngine. It supports the old
+ // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
+ // plugin registration via this function while apps migrate to use the new Android APIs
+ // post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
+ //
+ // It is encouraged to share logic between onAttachedToEngine and registerWith to keep
+ // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
+ // depending on the user's project. onAttachedToEngine or registerWith must both be defined
+ // in the same class.
+ companion object {
+ @JvmStatic
+ fun registerWith(registrar: Registrar) {
+ val speechPlugin = SpeechToTextPlugin()
+ speechPlugin.currentActivity = registrar.activity()
+ registrar.addRequestPermissionsResultListener(speechPlugin)
+ speechPlugin.onAttachedToEngine(registrar.context(), registrar.messenger())
+ }
+ }
+
+ private fun onAttachedToEngine(applicationContext: Context, messenger: BinaryMessenger) {
+ this.pluginContext = applicationContext;
+ channel = MethodChannel(messenger, pluginChannelName)
+ channel?.setMethodCallHandler(this)
+ }
+
+ override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
+ this.pluginContext = null;
+ channel?.setMethodCallHandler(null)
+ channel = null
+ }
+
+ override fun onDetachedFromActivity() {
+ currentActivity = null
+ }
+
+ override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
+ currentActivity = binding.activity
+ binding.addRequestPermissionsResultListener(this)
+ }
+
+ override fun onAttachedToActivity(binding: ActivityPluginBinding) {
+ currentActivity = binding.activity
+ binding.addRequestPermissionsResultListener(this)
+ }
+
+ override fun onDetachedFromActivityForConfigChanges() {
+ currentActivity = null
+ }
+
+ override fun onMethodCall(@NonNull call: MethodCall, @NonNull rawrResult: Result) {
+ val result = ChannelResultWrapper(rawrResult)
+ try {
+ when (call.method) {
+ "has_permission" -> hasPermission(result)
+ "initialize" -> {
+ var dlog = call.argument("debugLogging")
+ if (null != dlog) {
+ debugLogging = dlog
+ }
+ initialize(result)
+ }
+ "listen" -> {
+ var localeId = call.argument("localeId")
+ if (null == localeId) {
+ localeId = defaultLanguageTag
+ }
+ var partialResults = call.argument("partialResults")
+ if (null == partialResults) {
+ partialResults = true
+ }
+ val listenModeIndex = call.argument("listenMode")
+ if ( null == listenModeIndex ) {
+ result.error(SpeechToTextErrors.missingOrInvalidArg.name,
+ "listenMode is required", null)
+ return
+ }
+ startListening(result, localeId, partialResults, listenModeIndex )
+ }
+ "stop" -> stopListening(result)
+ "cancel" -> cancelListening(result)
+ "locales" -> locales(result)
+ else -> result.notImplemented()
+ }
+ } catch (exc: Exception) {
+ Log.e(logTag, "Unexpected exception", exc)
+ result.error(SpeechToTextErrors.unknown.name,
+ "Unexpected exception", exc.localizedMessage)
+ }
+ }
+
+ private fun hasPermission(result: Result) {
+ if (sdkVersionTooLow(result)) {
+ return
+ }
+ debugLog("Start has_permission")
+ val localContext = pluginContext
+ if (localContext != null) {
+ val hasPerm = ContextCompat.checkSelfPermission(localContext,
+ Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
+ result.success(hasPerm)
+ }
+ }
+
+ private fun initialize(result: Result) {
+ if (sdkVersionTooLow(result)) {
+ return
+ }
+ debugLog("Start initialize")
+ if (null != activeResult) {
+ result.error(SpeechToTextErrors.multipleRequests.name,
+ "Only one initialize at a time", null)
+ return
+ }
+ activeResult = result
+ val localContext = pluginContext
+ initializeIfPermitted(pluginContext)
+ }
+
+ private fun sdkVersionTooLow(result: Result): Boolean {
+ if (Build.VERSION.SDK_INT < minSdkForSpeechSupport) {
+ result.success(false)
+ return true;
+ }
+ return false;
+ }
+
+ private fun isNotInitialized(result: Result): Boolean {
+ if (!initializedSuccessfully || null == pluginContext) {
+ result.success(false)
+ }
+ return !initializedSuccessfully
+ }
+
+ private fun isListening(): Boolean {
+ return listening
+ }
+
+ private fun isNotListening(): Boolean {
+ return !listening
+ }
+
+ private fun startListening(result: Result, languageTag: String, partialResults: Boolean,
+ listenModeIndex: Int) {
+ if (sdkVersionTooLow(result) || isNotInitialized(result) || isListening()) {
+ return
+ }
+ debugLog("Start listening")
+ var listenMode = ListenMode.deviceDefault
+ if ( listenModeIndex == ListenMode.dictation.ordinal) {
+ listenMode = ListenMode.dictation
+ }
+ setupRecognizerIntent(languageTag, partialResults, listenMode)
+ handler.post {
+ run {
+ speechRecognizer?.startListening(recognizerIntent)
+ }
+ }
+ notifyListening(isRecording = true)
+ result.success(true)
+ debugLog("Start listening done")
+ }
+
+ private fun stopListening(result: Result) {
+ if (sdkVersionTooLow(result) || isNotInitialized(result) || isNotListening()) {
+ return
+ }
+ debugLog("Stop listening")
+ handler.post {
+ run {
+ speechRecognizer?.stopListening()
+ }
+ }
+ notifyListening(isRecording = false)
+ result.success(true)
+ debugLog("Stop listening done")
+ }
+
+ private fun cancelListening(result: Result) {
+ if (sdkVersionTooLow(result) || isNotInitialized(result) || isNotListening()) {
+ return
+ }
+ debugLog("Cancel listening")
+ handler.post {
+ run {
+ speechRecognizer?.cancel()
+ }
+ }
+ notifyListening(isRecording = false)
+ result.success(true)
+ debugLog("Cancel listening done")
+ }
+
+ private fun locales(result: Result) {
+ if (sdkVersionTooLow(result) || isNotInitialized(result)) {
+ return
+ }
+ var detailsIntent = RecognizerIntent.getVoiceDetailsIntent(pluginContext)
+ if (null == detailsIntent) {
+ detailsIntent = Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS)
+ }
+ if (null == detailsIntent) {
+ result.error(SpeechToTextErrors.noLanguageIntent.name,
+ "Could not get voice details", null)
+ return
+ }
+ pluginContext?.sendOrderedBroadcast(
+ detailsIntent, null, LanguageDetailsChecker(result),
+ null, Activity.RESULT_OK, null, null)
+ }
+
+ private fun notifyListening(isRecording: Boolean) {
+ debugLog("Notify listening")
+ listening = isRecording
+ val status = when (isRecording) {
+ true -> SpeechToTextStatus.listening.name
+ false -> SpeechToTextStatus.notListening.name
+ }
+ channel?.invokeMethod(SpeechToTextCallbackMethods.notifyStatus.name, status)
+ debugLog("Notify listening done")
+ }
+
+ private fun updateResults(speechBundle: Bundle?, isFinal: Boolean) {
+ if (isDuplicateFinal( isFinal )) {
+ debugLog("Discarding duplicate final")
+ return
+ }
+ val userSaid = speechBundle?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
+ if (null != userSaid && userSaid.isNotEmpty()) {
+ val speechResult = JSONObject()
+ speechResult.put("finalResult", isFinal)
+ val confidence = speechBundle?.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES)
+ val alternates = JSONArray()
+ for (resultIndex in 0..userSaid.size - 1) {
+ val speechWords = JSONObject()
+ speechWords.put("recognizedWords", userSaid[resultIndex])
+ if (null != confidence && confidence.size >= userSaid.size) {
+ speechWords.put("confidence", confidence[resultIndex])
+ } else {
+ speechWords.put("confidence", missingConfidence)
+ }
+ alternates.put(speechWords)
+ }
+ speechResult.put("alternates", alternates)
+ val jsonResult = speechResult.toString()
+ debugLog("Calling results callback")
+ channel?.invokeMethod(SpeechToTextCallbackMethods.textRecognition.name,
+ jsonResult)
+ }
+ }
+
+ private fun isDuplicateFinal( isFinal: Boolean ) : Boolean {
+ if ( !isFinal ) {
+ return false
+ }
+ val delta = System.currentTimeMillis() - lastFinalTime
+ lastFinalTime = System.currentTimeMillis()
+ return delta >= 0 && delta < 100
+ }
+
+ private fun initializeIfPermitted(context: Context?) {
+ val localContext = context
+ if (null == localContext) {
+ completeInitialize()
+ return
+ }
+ permissionToRecordAudio = ContextCompat.checkSelfPermission(localContext,
+ Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
+ debugLog("Checked permission")
+ if (!permissionToRecordAudio) {
+ val localActivity = currentActivity
+ if (null != localActivity) {
+ debugLog("Requesting permission")
+ ActivityCompat.requestPermissions(localActivity,
+ arrayOf(Manifest.permission.RECORD_AUDIO), speechToTextPermissionCode)
+ } else {
+ debugLog("no permission, no activity, completing")
+ completeInitialize()
+ }
+ } else {
+ debugLog("has permission, completing")
+ completeInitialize()
+ }
+ debugLog("leaving initializeIfPermitted")
+ }
+
+ private fun completeInitialize() {
+
+ debugLog("completeInitialize")
+ if (permissionToRecordAudio) {
+ debugLog("Testing recognition availability")
+ if (!SpeechRecognizer.isRecognitionAvailable(pluginContext)) {
+ Log.e(logTag, "Speech recognition not available on this device")
+ activeResult?.error(SpeechToTextErrors.recognizerNotAvailable.name,
+ "Speech recognition not available on this device", "")
+ activeResult = null
+ return
+ }
+
+ debugLog("Creating recognizer")
+ speechRecognizer = createSpeechRecognizer(pluginContext).apply {
+ debugLog("Setting listener")
+ setRecognitionListener(this@SpeechToTextPlugin)
+ }
+ if (null == speechRecognizer) {
+ Log.e(logTag, "Speech recognizer null")
+ activeResult?.error(
+ SpeechToTextErrors.recognizerNotAvailable.name,
+ "Speech recognizer null", "")
+ activeResult = null
+ }
+
+ debugLog("before setup intent")
+ setupRecognizerIntent(defaultLanguageTag, true, ListenMode.deviceDefault)
+ debugLog("after setup intent")
+ }
+
+ initializedSuccessfully = permissionToRecordAudio
+ debugLog("sending result")
+ activeResult?.success(permissionToRecordAudio)
+ debugLog("leaving complete")
+ activeResult = null
+ }
+
+ private fun setupRecognizerIntent(languageTag: String, partialResults: Boolean, listenMode: ListenMode) {
+ debugLog("setupRecognizerIntent")
+ if (previousRecognizerLang == null ||
+ previousRecognizerLang != languageTag ||
+ partialResults != previousPartialResults || previousListenMode != listenMode ) {
+ previousRecognizerLang = languageTag;
+ previousPartialResults = partialResults
+ previousListenMode = listenMode
+ handler.post {
+ run {
+ recognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
+ debugLog("In RecognizerIntent apply")
+ putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
+ debugLog("put model")
+ val localContext = pluginContext
+ if (null != localContext) {
+ putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
+ localContext.applicationInfo.packageName)
+ }
+ debugLog("put package")
+ putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, partialResults)
+ debugLog("put partial")
+ if (languageTag != Locale.getDefault().toLanguageTag()) {
+ putExtra(RecognizerIntent.EXTRA_LANGUAGE, languageTag);
+ debugLog("put languageTag")
+ }
+ }
+ }
+ }
+ }
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?,
+ grantResults: IntArray?): Boolean {
+ when (requestCode) {
+ speechToTextPermissionCode -> {
+ if (null != grantResults) {
+ permissionToRecordAudio = grantResults.isNotEmpty() &&
+ grantResults.get(0) == PackageManager.PERMISSION_GRANTED
+ }
+ completeInitialize()
+ return true
+ }
+ }
+ return false
+ }
+
+
+ override fun onPartialResults(results: Bundle?) = updateResults(results, false)
+ override fun onResults(results: Bundle?) = updateResults(results, true)
+ override fun onEndOfSpeech() = notifyListening(isRecording = false)
+
+ override fun onError(errorCode: Int) {
+ val errorMsg = when (errorCode) {
+ SpeechRecognizer.ERROR_AUDIO -> "error_audio_error"
+ SpeechRecognizer.ERROR_CLIENT -> "error_client"
+ SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS -> "error_permission"
+ SpeechRecognizer.ERROR_NETWORK -> "error_network"
+ SpeechRecognizer.ERROR_NETWORK_TIMEOUT -> "error_network_timeout"
+ SpeechRecognizer.ERROR_NO_MATCH -> "error_no_match"
+ SpeechRecognizer.ERROR_RECOGNIZER_BUSY -> "error_busy"
+ SpeechRecognizer.ERROR_SERVER -> "error_server"
+ SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "error_speech_timeout"
+ else -> "error_unknown"
+ }
+ sendError(errorMsg)
+ }
+
+ private fun debugLog( msg: String ) {
+ if ( debugLogging ) {
+ Log.d( logTag, msg )
+ }
+ }
+
+ private fun sendError(errorMsg: String) {
+ val speechError = JSONObject()
+ speechError.put("errorMsg", errorMsg)
+ speechError.put("permanent", true)
+ handler.post {
+ run {
+ channel?.invokeMethod(SpeechToTextCallbackMethods.notifyError.name, speechError.toString())
+ }
+ }
+ }
+
+ override fun onRmsChanged(rmsdB: Float) {
+ handler.post {
+ run {
+ channel?.invokeMethod(SpeechToTextCallbackMethods.soundLevelChange.name, rmsdB)
+ }
+ }
+ }
+
+ override fun onReadyForSpeech(p0: Bundle?) {}
+ override fun onBufferReceived(p0: ByteArray?) {}
+ override fun onEvent(p0: Int, p1: Bundle?) {}
+ override fun onBeginningOfSpeech() {}
+}
+
+// See https://stackoverflow.com/questions/10538791/how-to-set-the-language-in-speech-recognition-on-android/10548680#10548680
+class LanguageDetailsChecker(flutterResult: Result) : BroadcastReceiver() {
+ private val result: Result = flutterResult
+ private var supportedLanguages: List? = null
+
+ private var languagePreference: String? = null
+
+ override fun onReceive(context: Context, intent: Intent) {
+ val results = getResultExtras(true)
+ if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE)) {
+ languagePreference = results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE)
+ }
+ if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) {
+ supportedLanguages = results.getStringArrayList(
+ RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)
+ createResponse(supportedLanguages)
+ }
+ }
+
+ private fun createResponse(supportedLanguages: List?) {
+ val currentLocale = Locale.getDefault()
+ val localeNames = ArrayList()
+ localeNames.add(buildIdNameForLocale(currentLocale))
+ if (null != supportedLanguages) {
+ for (lang in supportedLanguages) {
+ if (currentLocale.toLanguageTag() == lang) {
+ continue
+ }
+ val locale = Locale.forLanguageTag(lang)
+ localeNames.add(buildIdNameForLocale(locale))
+ }
+ }
+ result.success(localeNames)
+
+ }
+
+ private fun buildIdNameForLocale(locale: Locale): String {
+ val name = locale.displayName.replace(':', ' ')
+ return "${locale.language}_${locale.country}:$name"
+ }
+}
+
+private class ChannelResultWrapper(result: Result) : Result {
+ // Caller handler
+ val handler: Handler = Handler(Looper.getMainLooper())
+ val result: Result = result
+
+ // make sure to respond in the caller thread
+ override fun success(results: Any?) {
+
+ handler.post {
+ run {
+ result.success(results);
+ }
+ }
+ }
+
+ override fun error(errorCode: String?, errorMessage: String?, data: Any?) {
+ handler.post {
+ run {
+ result.error(errorCode, errorMessage, data);
+ }
+ }
+ }
+
+ override fun notImplemented() {
+ handler.post {
+ run {
+ result.notImplemented();
+ }
+ }
+ }
+}
diff --git a/speech_to_text_/example/.gitignore b/speech_to_text_/example/.gitignore
new file mode 100644
index 00000000..2ddde2a5
--- /dev/null
+++ b/speech_to_text_/example/.gitignore
@@ -0,0 +1,73 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.buildlog/
+.history
+.svn/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+.dart_tool/
+.flutter-plugins
+.packages
+.pub-cache/
+.pub/
+/build/
+
+# Android related
+**/android/**/gradle-wrapper.jar
+**/android/.gradle
+**/android/captures/
+**/android/gradlew
+**/android/gradlew.bat
+**/android/local.properties
+**/android/**/GeneratedPluginRegistrant.java
+
+# iOS/XCode related
+**/ios/**/*.mode1v3
+**/ios/**/*.mode2v3
+**/ios/**/*.moved-aside
+**/ios/**/*.pbxuser
+**/ios/**/*.perspectivev3
+**/ios/**/*sync/
+**/ios/**/.sconsign.dblite
+**/ios/**/.tags*
+**/ios/**/.vagrant/
+**/ios/**/DerivedData/
+**/ios/**/Icon?
+**/ios/**/Pods/
+**/ios/**/.symlinks/
+**/ios/**/profile
+**/ios/**/xcuserdata
+**/ios/.generated/
+**/ios/Flutter/App.framework
+**/ios/Flutter/Flutter.framework
+**/ios/Flutter/Generated.xcconfig
+**/ios/Flutter/app.flx
+**/ios/Flutter/app.zip
+**/ios/Flutter/flutter_assets/
+**/ios/Flutter/flutter_export_environment.sh
+**/ios/ServiceDefinitions.json
+**/ios/Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!**/ios/**/default.mode1v3
+!**/ios/**/default.mode2v3
+!**/ios/**/default.pbxuser
+!**/ios/**/default.perspectivev3
+!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
diff --git a/speech_to_text_/example/.metadata b/speech_to_text_/example/.metadata
new file mode 100644
index 00000000..aeb01ee2
--- /dev/null
+++ b/speech_to_text_/example/.metadata
@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f
+ channel: stable
+
+project_type: app
diff --git a/speech_to_text_/example/README.md b/speech_to_text_/example/README.md
new file mode 100644
index 00000000..92252821
--- /dev/null
+++ b/speech_to_text_/example/README.md
@@ -0,0 +1,155 @@
+# speech_to_text_example
+
+Demonstrates how to use the speech_to_text plugin. This example requires
+that the plugin has been installed. It initializes speech recognition,
+listens for words and prints them.
+
+
+## Source
+
+```dart
+import 'package:flutter/material.dart';
+import 'dart:async';
+
+import 'package:speech_to_text/speech_to_text.dart';
+import 'package:speech_to_text/speech_recognition_result.dart';
+import 'package:speech_to_text/speech_recognition_error.dart';
+
+void main() => runApp(MyApp());
+
+class MyApp extends StatefulWidget {
+ @override
+ _MyAppState createState() => _MyAppState();
+}
+
+class _MyAppState extends State {
+ bool _hasSpeech = false;
+ String lastWords = "";
+ String lastError = "";
+ String lastStatus = "";
+ final SpeechToText speech = SpeechToText();
+
+ @override
+ void initState() {
+ super.initState();
+ initSpeechState();
+ }
+
+ Future initSpeechState() async {
+ bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener );
+
+ if (!mounted) return;
+ setState(() {
+ _hasSpeech = hasSpeech;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
+ title: const Text('Speech to Text Example'),
+ ),
+ body: _hasSpeech
+ ? Column(children: [
+ Expanded(
+ child: Center(
+ child: Text('Speech recognition available'),
+ ),
+ ),
+ Expanded(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ FlatButton(
+ child: Text('Start'),
+ onPressed: startListening,
+ ),
+ FlatButton(
+ child: Text('Stop'),
+ onPressed: stopListening,
+ ),
+ FlatButton(
+ child: Text('Cancel'),
+ onPressed:cancelListening,
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: Column(
+ children: [
+ Center(
+ child: Text('Recognized Words'),
+ ),
+ Center(
+ child: Text(lastWords),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: Column(
+ children: [
+ Center(
+ child: Text('Error'),
+ ),
+ Center(
+ child: Text(lastError),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: Center(
+ child: speech.isListening ? Text("I'm listening...") : Text( 'Not listening' ),
+ ),
+ ),
+ ])
+ : Center( child: Text('Speech recognition unavailable', style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold))),
+ ),
+ );
+ }
+
+ void startListening() {
+ lastWords = "";
+ lastError = "";
+ speech.listen(onResult: resultListener );
+ setState(() {
+
+ });
+ }
+
+ void stopListening() {
+ speech.stop( );
+ setState(() {
+
+ });
+ }
+
+ void cancelListening() {
+ speech.cancel( );
+ setState(() {
+
+ });
+ }
+
+ void resultListener(SpeechRecognitionResult result) {
+ setState(() {
+ lastWords = "${result.recognizedWords} - ${result.finalResult}";
+ });
+ }
+
+ void errorListener(SpeechRecognitionError error ) {
+ setState(() {
+ lastError = "${error.errorMsg} - ${error.permanent}";
+ });
+ }
+ void statusListener(String status ) {
+ setState(() {
+ lastStatus = "$status";
+ });
+ }
+}
+```
\ No newline at end of file
diff --git a/speech_to_text_/example/android/.project b/speech_to_text_/example/android/.project
new file mode 100644
index 00000000..d7d48141
--- /dev/null
+++ b/speech_to_text_/example/android/.project
@@ -0,0 +1,17 @@
+
+
+ android___
+ Project android___ created by Buildship.
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/speech_to_text_/example/android/.settings/org.eclipse.buildship.core.prefs b/speech_to_text_/example/android/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 00000000..e8895216
--- /dev/null
+++ b/speech_to_text_/example/android/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,2 @@
+connection.project.dir=
+eclipse.preferences.version=1
diff --git a/speech_to_text_/example/android/app/build.gradle b/speech_to_text_/example/android/app/build.gradle
new file mode 100644
index 00000000..8b616f29
--- /dev/null
+++ b/speech_to_text_/example/android/app/build.gradle
@@ -0,0 +1,67 @@
+def localProperties = new Properties()
+def localPropertiesFile = rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ localPropertiesFile.withReader('UTF-8') { reader ->
+ localProperties.load(reader)
+ }
+}
+
+def flutterRoot = localProperties.getProperty('flutter.sdk')
+if (flutterRoot == null) {
+ throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
+}
+
+def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
+if (flutterVersionCode == null) {
+ flutterVersionCode = '1'
+}
+
+def flutterVersionName = localProperties.getProperty('flutter.versionName')
+if (flutterVersionName == null) {
+ flutterVersionName = '1.0'
+}
+
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
+android {
+ compileSdkVersion 28
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+
+ lintOptions {
+ disable 'InvalidPackage'
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId "com.csdcorp.speech_to_text_example"
+ minSdkVersion 21
+ targetSdkVersion 28
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig signingConfigs.debug
+ }
+ }
+}
+
+flutter {
+ source '../..'
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test:runner:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
+}
diff --git a/speech_to_text_/example/android/app/src/debug/AndroidManifest.xml b/speech_to_text_/example/android/app/src/debug/AndroidManifest.xml
new file mode 100644
index 00000000..36edf838
--- /dev/null
+++ b/speech_to_text_/example/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/speech_to_text_/example/android/app/src/main/AndroidManifest.xml b/speech_to_text_/example/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..b0912061
--- /dev/null
+++ b/speech_to_text_/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/speech_to_text_/example/android/app/src/main/kotlin/com/csdcorp/speech_to_text_example/MainActivity.kt b/speech_to_text_/example/android/app/src/main/kotlin/com/csdcorp/speech_to_text_example/MainActivity.kt
new file mode 100644
index 00000000..f44e470e
--- /dev/null
+++ b/speech_to_text_/example/android/app/src/main/kotlin/com/csdcorp/speech_to_text_example/MainActivity.kt
@@ -0,0 +1,12 @@
+package com.csdcorp.speech_to_text_example
+
+import androidx.annotation.NonNull;
+import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugins.GeneratedPluginRegistrant
+
+class MainActivity: FlutterActivity() {
+ override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
+ GeneratedPluginRegistrant.registerWith(flutterEngine);
+ }
+}
diff --git a/speech_to_text_/example/android/app/src/main/res/drawable/launch_background.xml b/speech_to_text_/example/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 00000000..304732f8
--- /dev/null
+++ b/speech_to_text_/example/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/speech_to_text_/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/speech_to_text_/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..db77bb4b
Binary files /dev/null and b/speech_to_text_/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/speech_to_text_/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/speech_to_text_/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..17987b79
Binary files /dev/null and b/speech_to_text_/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/speech_to_text_/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/speech_to_text_/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..09d43914
Binary files /dev/null and b/speech_to_text_/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/speech_to_text_/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/speech_to_text_/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..d5f1c8d3
Binary files /dev/null and b/speech_to_text_/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/speech_to_text_/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/speech_to_text_/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..4d6372ee
Binary files /dev/null and b/speech_to_text_/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/speech_to_text_/example/android/app/src/main/res/values/styles.xml b/speech_to_text_/example/android/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..00fa4417
--- /dev/null
+++ b/speech_to_text_/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/speech_to_text_/example/android/app/src/profile/AndroidManifest.xml b/speech_to_text_/example/android/app/src/profile/AndroidManifest.xml
new file mode 100644
index 00000000..36edf838
--- /dev/null
+++ b/speech_to_text_/example/android/app/src/profile/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/speech_to_text_/example/android/build.gradle b/speech_to_text_/example/android/build.gradle
new file mode 100644
index 00000000..13546311
--- /dev/null
+++ b/speech_to_text_/example/android/build.gradle
@@ -0,0 +1,31 @@
+buildscript {
+ ext.kotlin_version = '1.3.50'
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.6.1'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+rootProject.buildDir = '../build'
+subprojects {
+ project.buildDir = "${rootProject.buildDir}/${project.name}"
+}
+subprojects {
+ project.evaluationDependsOn(':app')
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/speech_to_text_/example/android/gradle.properties b/speech_to_text_/example/android/gradle.properties
new file mode 100644
index 00000000..a6738207
--- /dev/null
+++ b/speech_to_text_/example/android/gradle.properties
@@ -0,0 +1,4 @@
+org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
+android.enableR8=true
diff --git a/speech_to_text_/example/android/gradle/wrapper/gradle-wrapper.properties b/speech_to_text_/example/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..052e7951
--- /dev/null
+++ b/speech_to_text_/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Mar 16 08:57:32 EDT 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/speech_to_text_/example/android/settings.gradle b/speech_to_text_/example/android/settings.gradle
new file mode 100644
index 00000000..5a2f14fb
--- /dev/null
+++ b/speech_to_text_/example/android/settings.gradle
@@ -0,0 +1,15 @@
+include ':app'
+
+def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+
+def plugins = new Properties()
+def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
+if (pluginsFile.exists()) {
+ pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
+}
+
+plugins.each { name, path ->
+ def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
+ include ":$name"
+ project(":$name").projectDir = pluginDirectory
+}
diff --git a/speech_to_text_/example/ios/Flutter/AppFrameworkInfo.plist b/speech_to_text_/example/ios/Flutter/AppFrameworkInfo.plist
new file mode 100644
index 00000000..6b4c0f78
--- /dev/null
+++ b/speech_to_text_/example/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ App
+ CFBundleIdentifier
+ io.flutter.flutter.app
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ App
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ MinimumOSVersion
+ 8.0
+
+
diff --git a/speech_to_text_/example/ios/Flutter/Debug.xcconfig b/speech_to_text_/example/ios/Flutter/Debug.xcconfig
new file mode 100644
index 00000000..e8efba11
--- /dev/null
+++ b/speech_to_text_/example/ios/Flutter/Debug.xcconfig
@@ -0,0 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
+#include "Generated.xcconfig"
diff --git a/speech_to_text_/example/ios/Flutter/Flutter.podspec b/speech_to_text_/example/ios/Flutter/Flutter.podspec
new file mode 100644
index 00000000..5ca30416
--- /dev/null
+++ b/speech_to_text_/example/ios/Flutter/Flutter.podspec
@@ -0,0 +1,18 @@
+#
+# NOTE: This podspec is NOT to be published. It is only used as a local source!
+#
+
+Pod::Spec.new do |s|
+ s.name = 'Flutter'
+ s.version = '1.0.0'
+ s.summary = 'High-performance, high-fidelity mobile apps.'
+ s.description = <<-DESC
+Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
+ DESC
+ s.homepage = 'https://flutter.io'
+ s.license = { :type => 'MIT' }
+ s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
+ s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
+ s.ios.deployment_target = '8.0'
+ s.vendored_frameworks = 'Flutter.framework'
+end
diff --git a/speech_to_text_/example/ios/Flutter/Release.xcconfig b/speech_to_text_/example/ios/Flutter/Release.xcconfig
new file mode 100644
index 00000000..399e9340
--- /dev/null
+++ b/speech_to_text_/example/ios/Flutter/Release.xcconfig
@@ -0,0 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
+#include "Generated.xcconfig"
diff --git a/speech_to_text_/example/ios/Podfile b/speech_to_text_/example/ios/Podfile
new file mode 100644
index 00000000..ab7d5b46
--- /dev/null
+++ b/speech_to_text_/example/ios/Podfile
@@ -0,0 +1,90 @@
+# Uncomment this line to define a global platform for your project
+platform :ios, '10.0'
+
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+
+project 'Runner', {
+ 'Debug' => :debug,
+ 'Profile' => :release,
+ 'Release' => :release,
+}
+
+def parse_KV_file(file, separator='=')
+ file_abs_path = File.expand_path(file)
+ if !File.exists? file_abs_path
+ return [];
+ end
+ generated_key_values = {}
+ skip_line_start_symbols = ["#", "/"]
+ File.foreach(file_abs_path) do |line|
+ next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
+ plugin = line.split(pattern=separator)
+ if plugin.length == 2
+ podname = plugin[0].strip()
+ path = plugin[1].strip()
+ podpath = File.expand_path("#{path}", file_abs_path)
+ generated_key_values[podname] = podpath
+ else
+ puts "Invalid plugin specification: #{line}"
+ end
+ end
+ generated_key_values
+end
+
+target 'Runner' do
+ use_frameworks!
+ use_modular_headers!
+
+ # Flutter Pod
+
+ copied_flutter_dir = File.join(__dir__, 'Flutter')
+ copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
+ copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
+ unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
+ # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
+ # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
+ # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
+
+ generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
+ unless File.exist?(generated_xcode_build_settings_path)
+ raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
+ end
+ generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
+ cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
+
+ unless File.exist?(copied_framework_path)
+ FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
+ end
+ unless File.exist?(copied_podspec_path)
+ FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
+ end
+ end
+
+ # Keep pod path relative so it can be checked into Podfile.lock.
+ pod 'Flutter', :path => 'Flutter'
+
+ # Plugin Pods
+
+ # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
+ # referring to absolute paths on developers' machines.
+ system('rm -rf .symlinks')
+ system('mkdir -p .symlinks/plugins')
+ plugin_pods = parse_KV_file('../.flutter-plugins')
+ plugin_pods.each do |name, path|
+ symlink = File.join('.symlinks', 'plugins', name)
+ File.symlink(path, symlink)
+ pod name, :path => File.join(symlink, 'ios')
+ end
+end
+
+# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
+install! 'cocoapods', :disable_input_output_paths => true
+
+post_install do |installer|
+ installer.pods_project.targets.each do |target|
+ target.build_configurations.each do |config|
+ config.build_settings['ENABLE_BITCODE'] = 'NO'
+ end
+ end
+end
diff --git a/speech_to_text_/example/ios/Podfile.lock b/speech_to_text_/example/ios/Podfile.lock
new file mode 100644
index 00000000..60c8b57d
--- /dev/null
+++ b/speech_to_text_/example/ios/Podfile.lock
@@ -0,0 +1,29 @@
+PODS:
+ - Flutter (1.0.0)
+ - speech_to_text (0.0.1):
+ - Flutter
+ - Try
+ - Try (2.1.1)
+
+DEPENDENCIES:
+ - Flutter (from `Flutter`)
+ - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
+
+SPEC REPOS:
+ trunk:
+ - Try
+
+EXTERNAL SOURCES:
+ Flutter:
+ :path: Flutter
+ speech_to_text:
+ :path: ".symlinks/plugins/speech_to_text/ios"
+
+SPEC CHECKSUMS:
+ Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
+ speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
+ Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
+
+PODFILE CHECKSUM: 0ba44ad07df4ab62269dc769727cf0f12b1e453d
+
+COCOAPODS: 1.9.3
diff --git a/speech_to_text_/example/ios/Runner.xcodeproj/project.pbxproj b/speech_to_text_/example/ios/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..c40af650
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,578 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ C446300A034BF27D9F1ACEF9 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E76E9615C6B4FABD88067D55 /* Pods_Runner.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 59AFE6BB0B596A0E0811BDFF /* 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 = ""; };
+ 6280E2A777726D2043BF80B7 /* 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 = ""; };
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ C3909A4B7EC98A20255210E3 /* 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 = ""; };
+ E76E9615C6B4FABD88067D55 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 97C146EB1CF9000F007C117D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C446300A034BF27D9F1ACEF9 /* Pods_Runner.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 7937AF765430D66F28F7FEEF /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ E76E9615C6B4FABD88067D55 /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 9740EEB11CF90186004384FC /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,
+ );
+ name = Flutter;
+ sourceTree = "";
+ };
+ 97C146E51CF9000F007C117D = {
+ isa = PBXGroup;
+ children = (
+ 9740EEB11CF90186004384FC /* Flutter */,
+ 97C146F01CF9000F007C117D /* Runner */,
+ 97C146EF1CF9000F007C117D /* Products */,
+ A68CCF1640763A551D35BD31 /* Pods */,
+ 7937AF765430D66F28F7FEEF /* Frameworks */,
+ );
+ sourceTree = "";
+ };
+ 97C146EF1CF9000F007C117D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146EE1CF9000F007C117D /* Runner.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 97C146F01CF9000F007C117D /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146FA1CF9000F007C117D /* Main.storyboard */,
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
+ 97C147021CF9000F007C117D /* Info.plist */,
+ 97C146F11CF9000F007C117D /* Supporting Files */,
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
+ );
+ path = Runner;
+ sourceTree = "";
+ };
+ 97C146F11CF9000F007C117D /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+ A68CCF1640763A551D35BD31 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 59AFE6BB0B596A0E0811BDFF /* Pods-Runner.debug.xcconfig */,
+ 6280E2A777726D2043BF80B7 /* Pods-Runner.release.xcconfig */,
+ C3909A4B7EC98A20255210E3 /* Pods-Runner.profile.xcconfig */,
+ );
+ path = Pods;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 97C146ED1CF9000F007C117D /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ 949FCB95217187F2C022D6A9 /* [CP] Check Pods Manifest.lock */,
+ 9740EEB61CF901F6004384FC /* Run Script */,
+ 97C146EA1CF9000F007C117D /* Sources */,
+ 97C146EB1CF9000F007C117D /* Frameworks */,
+ 97C146EC1CF9000F007C117D /* Resources */,
+ 9705A1C41CF9048500538489 /* Embed Frameworks */,
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ 8B0988F04B6AE44AA0304FEF /* [CP] Embed Pods Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 97C146E61CF9000F007C117D /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 1020;
+ ORGANIZATIONNAME = "The Chromium Authors";
+ TargetAttributes = {
+ 97C146ED1CF9000F007C117D = {
+ CreatedOnToolsVersion = 7.3.1;
+ DevelopmentTeam = 3X949YE9K2;
+ LastSwiftMigration = 0910;
+ };
+ };
+ };
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 97C146E51CF9000F007C117D;
+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 97C146ED1CF9000F007C117D /* Runner */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 97C146EC1CF9000F007C117D /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
+ 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ };
+ 8B0988F04B6AE44AA0304FEF /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 949FCB95217187F2C022D6A9 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 97C146EA1CF9000F007C117D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C146FB1CF9000F007C117D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C147001CF9000F007C117D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 249021D3217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Profile;
+ };
+ 249021D4217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = 3X949YE9K2;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.csdcorp.speechToTextExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Profile;
+ };
+ 97C147031CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 97C147041CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 97C147061CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = 3X949YE9K2;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.csdcorp.speechToTextExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Debug;
+ };
+ 97C147071CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = 3X949YE9K2;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.csdcorp.speechToTextExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147031CF9000F007C117D /* Debug */,
+ 97C147041CF9000F007C117D /* Release */,
+ 249021D3217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147061CF9000F007C117D /* Debug */,
+ 97C147071CF9000F007C117D /* Release */,
+ 249021D4217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 97C146E61CF9000F007C117D /* Project object */;
+}
diff --git a/speech_to_text_/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/speech_to_text_/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..1d526a16
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/speech_to_text_/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/speech_to_text_/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 00000000..a28140cf
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/speech_to_text_/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/speech_to_text_/example/ios/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..21a3cc14
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/speech_to_text_/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/speech_to_text_/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/speech_to_text_/example/ios/Runner/AppDelegate.swift b/speech_to_text_/example/ios/Runner/AppDelegate.swift
new file mode 100644
index 00000000..70693e4a
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/AppDelegate.swift
@@ -0,0 +1,13 @@
+import UIKit
+import Flutter
+
+@UIApplicationMain
+@objc class AppDelegate: FlutterAppDelegate {
+ override func application(
+ _ application: UIApplication,
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
+ ) -> Bool {
+ GeneratedPluginRegistrant.register(with: self)
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+}
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 00000000..d36b1fab
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@
+{
+ "images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-83.5x83.5@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "Icon-App-1024x1024@1x.png",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
new file mode 100644
index 00000000..dc9ada47
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
new file mode 100644
index 00000000..28c6bf03
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
new file mode 100644
index 00000000..2ccbfd96
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
new file mode 100644
index 00000000..f091b6b0
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
new file mode 100644
index 00000000..4cde1211
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
new file mode 100644
index 00000000..d0ef06e7
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
new file mode 100644
index 00000000..dcdc2306
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
new file mode 100644
index 00000000..2ccbfd96
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
new file mode 100644
index 00000000..c8f9ed8f
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
new file mode 100644
index 00000000..a6d6b860
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
new file mode 100644
index 00000000..a6d6b860
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
new file mode 100644
index 00000000..75b2d164
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
new file mode 100644
index 00000000..c4df70d3
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
new file mode 100644
index 00000000..6a84f41e
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
new file mode 100644
index 00000000..d0e1f585
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
new file mode 100644
index 00000000..0bedcf2f
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ
diff --git a/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
new file mode 100644
index 00000000..89c2725b
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@
+# Launch Screen Assets
+
+You can customize the launch screen with your own desired assets by replacing the image files in this directory.
+
+You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
diff --git a/speech_to_text_/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/speech_to_text_/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 00000000..f2e259c7
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/speech_to_text_/example/ios/Runner/Base.lproj/Main.storyboard b/speech_to_text_/example/ios/Runner/Base.lproj/Main.storyboard
new file mode 100644
index 00000000..f3c28516
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/speech_to_text_/example/ios/Runner/Info.plist b/speech_to_text_/example/ios/Runner/Info.plist
new file mode 100644
index 00000000..a69c0fce
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Info.plist
@@ -0,0 +1,49 @@
+
+
+
+
+ NSMicrophoneUsageDescription
+ This example listens for speech on the device microphone on your request.
+ NSSpeechRecognitionUsageDescription
+ This example recognizes words as you speak them and displays them.
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ speech_to_text_example
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIViewControllerBasedStatusBarAppearance
+
+
+
diff --git a/speech_to_text_/example/ios/Runner/Runner-Bridging-Header.h b/speech_to_text_/example/ios/Runner/Runner-Bridging-Header.h
new file mode 100644
index 00000000..7335fdf9
--- /dev/null
+++ b/speech_to_text_/example/ios/Runner/Runner-Bridging-Header.h
@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"
\ No newline at end of file
diff --git a/speech_to_text_/example/lib/main.dart b/speech_to_text_/example/lib/main.dart
new file mode 100644
index 00000000..0115b828
--- /dev/null
+++ b/speech_to_text_/example/lib/main.dart
@@ -0,0 +1,275 @@
+import 'dart:async';
+import 'dart:math';
+
+import 'package:flutter/material.dart';
+import 'package:permission_handler/permission_handler.dart';
+import 'package:speech_to_text/speech_recognition_error.dart';
+import 'package:speech_to_text/speech_recognition_result.dart';
+import 'package:speech_to_text/speech_to_text.dart';
+
+void main() => runApp(MyApp());
+
+class MyApp extends StatefulWidget {
+ @override
+ _MyAppState createState() => _MyAppState();
+}
+
+class _MyAppState extends State {
+ bool _hasSpeech = false;
+ double level = 0.0;
+ double minSoundLevel = 50000;
+ double maxSoundLevel = -50000;
+ String lastWords = "";
+ String lastError = "";
+ String lastStatus = "";
+ String _currentLocaleId = "";
+ List _localeNames = [];
+ final SpeechToText speech = SpeechToText();
+
+ @override
+ void initState() {
+ requestPermissions();
+ super.initState();
+ }
+
+ Future initSpeechState() async {
+ bool hasSpeech = await speech.initialize(
+ onError: errorListener, onStatus: statusListener);
+ if (hasSpeech) {
+ _localeNames = await speech.locales();
+
+ var systemLocale = await speech.systemLocale();
+ _currentLocaleId = systemLocale.localeId;
+ }
+
+ if (!mounted) return;
+
+ setState(() {
+ _hasSpeech = hasSpeech;
+ });
+ }
+
+ void requestPermissions() async{
+ Map statuses = await [
+ Permission.microphone,
+ ].request();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
+ title: const Text('Speech to Text CloudSolution'),
+ ),
+ body: Column(children: [
+ Center(
+ child: Text(
+ 'Speech recognition available',
+ style: TextStyle(fontSize: 22.0),
+ ),
+ ),
+ Container(
+ child: Column(
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ FlatButton(
+ child: Text('Initialize'),
+ onPressed: _hasSpeech ? null : initSpeechState,
+ ),
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ FlatButton(
+ child: Text('Start'),
+ onPressed: !_hasSpeech || speech.isListening
+ ? null
+ : startListening,
+ ),
+ FlatButton(
+ child: Text('Stop'),
+ onPressed: speech.isListening ? stopListening : null,
+ ),
+ FlatButton(
+ child: Text('Cancel'),
+ onPressed: speech.isListening ? cancelListening : null,
+ ),
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ DropdownButton(
+ onChanged: (selectedVal) => _switchLang(selectedVal),
+ value: _currentLocaleId,
+ items: _localeNames
+ .map(
+ (localeName) => DropdownMenuItem(
+ value: localeName.localeId,
+ child: Text(localeName.name),
+ ),
+ )
+ .toList(),
+ ),
+ ],
+ )
+ ],
+ ),
+ ),
+ Expanded(
+ flex: 4,
+ child: Column(
+ children: [
+ Center(
+ child: Text(
+ 'Recognized Words',
+ style: TextStyle(fontSize: 22.0),
+ ),
+ ),
+ Expanded(
+ child: Stack(
+ children: [
+ Container(
+ color: Theme.of(context).selectedRowColor,
+ child: Center(
+ child: Text(
+ lastWords,
+ textAlign: TextAlign.center,
+ ),
+ ),
+ ),
+ Positioned.fill(
+ bottom: 10,
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Container(
+ width: 40,
+ height: 40,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ boxShadow: [
+ BoxShadow(
+ blurRadius: .26,
+ spreadRadius: level * 1.5,
+ color: Colors.black.withOpacity(.05))
+ ],
+ color: Colors.white,
+ borderRadius:
+ BorderRadius.all(Radius.circular(50)),
+ ),
+ child: IconButton(icon: Icon(Icons.mic)),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ flex: 1,
+ child: Column(
+ children: [
+ Center(
+ child: Text(
+ 'Error Status',
+ style: TextStyle(fontSize: 22.0),
+ ),
+ ),
+ Center(
+ child: Text(lastError),
+ ),
+ ],
+ ),
+ ),
+ Container(
+ padding: EdgeInsets.symmetric(vertical: 20),
+ color: Theme.of(context).backgroundColor,
+ child: Center(
+ child: speech.isListening
+ ? Text(
+ "I'm listening...",
+ style: TextStyle(fontWeight: FontWeight.bold),
+ )
+ : Text(
+ 'Not listening',
+ style: TextStyle(fontWeight: FontWeight.bold),
+ ),
+ ),
+ ),
+ ]),
+ ),
+ );
+ }
+
+ void startListening() {
+ lastWords = "";
+ lastError = "";
+ speech.listen(
+ onResult: resultListener,
+ listenFor: Duration(seconds: 10),
+ localeId: _currentLocaleId,
+ onSoundLevelChange: soundLevelListener,
+ cancelOnError: true,
+ partialResults: true,
+ onDevice: true,
+ listenMode: ListenMode.confirmation);
+ setState(() {});
+ }
+
+ void stopListening() {
+ speech.stop();
+ setState(() {
+ level = 0.0;
+ });
+ }
+
+ void cancelListening() {
+ speech.cancel();
+ setState(() {
+ level = 0.0;
+ });
+ }
+
+ void resultListener(SpeechRecognitionResult result) {
+ setState(() {
+ lastWords = "${result.recognizedWords} - ${result.finalResult}";
+ });
+ }
+
+ void soundLevelListener(double level) {
+ minSoundLevel = min(minSoundLevel, level);
+ maxSoundLevel = max(maxSoundLevel, level);
+ // print("sound level $level: $minSoundLevel - $maxSoundLevel ");
+ setState(() {
+ this.level = level;
+ });
+ }
+
+ void errorListener(SpeechRecognitionError error) {
+ // print("Received error status: $error, listening: ${speech.isListening}");
+ setState(() {
+ lastError = "${error.errorMsg} - ${error.permanent}";
+ });
+ }
+
+ void statusListener(String status) {
+ // print(
+ // "Received listener status: $status, listening: ${speech.isListening}");
+ setState(() {
+ lastStatus = "$status";
+ });
+ }
+
+ _switchLang(selectedVal) {
+ setState(() {
+ _currentLocaleId = selectedVal;
+ });
+ print(selectedVal);
+ }
+}
diff --git a/speech_to_text_/ios/.gitignore b/speech_to_text_/ios/.gitignore
new file mode 100644
index 00000000..aa479fd3
--- /dev/null
+++ b/speech_to_text_/ios/.gitignore
@@ -0,0 +1,37 @@
+.idea/
+.vagrant/
+.sconsign.dblite
+.svn/
+
+.DS_Store
+*.swp
+profile
+
+DerivedData/
+build/
+GeneratedPluginRegistrant.h
+GeneratedPluginRegistrant.m
+
+.generated/
+
+*.pbxuser
+*.mode1v3
+*.mode2v3
+*.perspectivev3
+
+!default.pbxuser
+!default.mode1v3
+!default.mode2v3
+!default.perspectivev3
+
+xcuserdata
+
+*.moved-aside
+
+*.pyc
+*sync/
+Icon?
+.tags*
+
+/Flutter/Generated.xcconfig
+/Flutter/flutter_export_environment.sh
\ No newline at end of file
diff --git a/speech_to_text_/ios/Assets/.gitkeep b/speech_to_text_/ios/Assets/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/speech_to_text_/ios/Classes/SpeechToTextPlugin.h b/speech_to_text_/ios/Classes/SpeechToTextPlugin.h
new file mode 100644
index 00000000..1785eb8f
--- /dev/null
+++ b/speech_to_text_/ios/Classes/SpeechToTextPlugin.h
@@ -0,0 +1,4 @@
+#import
+
+@interface SpeechToTextPlugin : NSObject
+@end
diff --git a/speech_to_text_/ios/Classes/SpeechToTextPlugin.m b/speech_to_text_/ios/Classes/SpeechToTextPlugin.m
new file mode 100644
index 00000000..20d0327d
--- /dev/null
+++ b/speech_to_text_/ios/Classes/SpeechToTextPlugin.m
@@ -0,0 +1,8 @@
+#import "SpeechToTextPlugin.h"
+#import
+
+@implementation SpeechToTextPlugin
++ (void)registerWithRegistrar:(NSObject*)registrar {
+ [SwiftSpeechToTextPlugin registerWithRegistrar:registrar];
+}
+@end
diff --git a/speech_to_text_/ios/Classes/SwiftSpeechToTextPlugin.swift b/speech_to_text_/ios/Classes/SwiftSpeechToTextPlugin.swift
new file mode 100644
index 00000000..68687967
--- /dev/null
+++ b/speech_to_text_/ios/Classes/SwiftSpeechToTextPlugin.swift
@@ -0,0 +1,580 @@
+import Flutter
+import UIKit
+import Speech
+import os.log
+import Try
+
+public enum SwiftSpeechToTextMethods: String {
+ case has_permission
+ case initialize
+ case listen
+ case stop
+ case cancel
+ case locales
+ case unknown // just for testing
+}
+
+public enum SwiftSpeechToTextCallbackMethods: String {
+ case textRecognition
+ case notifyStatus
+ case notifyError
+ case soundLevelChange
+}
+
+public enum SpeechToTextStatus: String {
+ case listening
+ case notListening
+ case unavailable
+ case available
+}
+
+public enum SpeechToTextErrors: String {
+ case onDeviceError
+ case noRecognizerError
+ case listenFailedError
+ case missingOrInvalidArg
+}
+
+public enum ListenMode: Int {
+ case deviceDefault = 0
+ case dictation = 1
+ case search = 2
+ case confirmation = 3
+}
+
+struct SpeechRecognitionWords : Codable {
+ let recognizedWords: String
+ let confidence: Decimal
+}
+
+struct SpeechRecognitionResult : Codable {
+ let alternates: [SpeechRecognitionWords]
+ let finalResult: Bool
+}
+
+struct SpeechRecognitionError : Codable {
+ let errorMsg: String
+ let permanent: Bool
+}
+
+enum SpeechToTextError: Error {
+ case runtimeError(String)
+}
+
+
+@available(iOS 10.0, *)
+public class SwiftSpeechToTextPlugin: NSObject, FlutterPlugin {
+ private var channel: FlutterMethodChannel
+ private var registrar: FlutterPluginRegistrar
+ private var recognizer: SFSpeechRecognizer?
+ private var currentRequest: SFSpeechAudioBufferRecognitionRequest?
+ private var currentTask: SFSpeechRecognitionTask?
+ private var listeningSound: AVAudioPlayer?
+ private var successSound: AVAudioPlayer?
+ private var cancelSound: AVAudioPlayer?
+ private var rememberedAudioCategory: AVAudioSession.Category?
+ private var previousLocale: Locale?
+ private var onPlayEnd: (() -> Void)?
+ private var returnPartialResults: Bool = true
+ private var failedListen: Bool = false
+ private var listening = false
+ private let audioSession = AVAudioSession.sharedInstance()
+ private let audioEngine = AVAudioEngine()
+ private let jsonEncoder = JSONEncoder()
+ private let busForNodeTap = 0
+ private let speechBufferSize: AVAudioFrameCount = 1024
+ private static var subsystem = Bundle.main.bundleIdentifier!
+ private let pluginLog = OSLog(subsystem: "com.csdcorp.speechToText", category: "plugin")
+
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ let channel = FlutterMethodChannel(name: "plugin.csdcorp.com/speech_to_text", binaryMessenger: registrar.messenger())
+ let instance = SwiftSpeechToTextPlugin( channel, registrar: registrar )
+ registrar.addMethodCallDelegate(instance, channel: channel )
+ }
+
+ init( _ channel: FlutterMethodChannel, registrar: FlutterPluginRegistrar ) {
+ self.channel = channel
+ self.registrar = registrar
+ }
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ switch call.method {
+ case SwiftSpeechToTextMethods.has_permission.rawValue:
+ hasPermission( result )
+ case SwiftSpeechToTextMethods.initialize.rawValue:
+ initialize( result )
+ case SwiftSpeechToTextMethods.listen.rawValue:
+ guard let argsArr = call.arguments as? Dictionary,
+ let partialResults = argsArr["partialResults"] as? Bool, let onDevice = argsArr["onDevice"] as? Bool, let listenModeIndex = argsArr["listenMode"] as? Int
+ else {
+ DispatchQueue.main.async {
+ result(FlutterError( code: SpeechToTextErrors.missingOrInvalidArg.rawValue,
+ message:"Missing arg partialResults, onDevice, and listenMode are required",
+ details: nil ))
+ }
+ return
+ }
+ var localeStr: String? = nil
+ if let localeParam = argsArr["localeId"] as? String {
+ localeStr = localeParam
+ }
+ guard let listenMode = ListenMode(rawValue: listenModeIndex) else {
+ DispatchQueue.main.async {
+ result(FlutterError( code: SpeechToTextErrors.missingOrInvalidArg.rawValue,
+ message:"invalid value for listenMode, must be 0-2, was \(listenModeIndex)",
+ details: nil ))
+ }
+ return
+ }
+
+ listenForSpeech( result, localeStr: localeStr, partialResults: partialResults, onDevice: onDevice, listenMode: listenMode )
+ case SwiftSpeechToTextMethods.stop.rawValue:
+ stopSpeech( result )
+ case SwiftSpeechToTextMethods.cancel.rawValue:
+ cancelSpeech( result )
+ case SwiftSpeechToTextMethods.locales.rawValue:
+ locales( result )
+ default:
+ os_log("Unrecognized method: %{PUBLIC}@", log: pluginLog, type: .error, call.method)
+ DispatchQueue.main.async {
+ result( FlutterMethodNotImplemented)
+ }
+ }
+ }
+
+ private func hasPermission( _ result: @escaping FlutterResult) {
+ let has = SFSpeechRecognizer.authorizationStatus() == SFSpeechRecognizerAuthorizationStatus.authorized &&
+ AVAudioSession.sharedInstance().recordPermission == AVAudioSession.RecordPermission.granted
+ DispatchQueue.main.async {
+ result( has )
+ }
+ }
+
+ private func initialize( _ result: @escaping FlutterResult) {
+ var success = false
+ let status = SFSpeechRecognizer.authorizationStatus()
+ switch status {
+ case SFSpeechRecognizerAuthorizationStatus.notDetermined:
+ SFSpeechRecognizer.requestAuthorization({(status)->Void in
+ success = status == SFSpeechRecognizerAuthorizationStatus.authorized
+ if ( success ) {
+ AVAudioSession.sharedInstance().requestRecordPermission({(granted: Bool)-> Void in
+ if granted {
+ self.setupSpeechRecognition(result)
+ } else{
+ self.sendBoolResult( false, result );
+ os_log("User denied permission", log: self.pluginLog, type: .info)
+ }
+ })
+ }
+ else {
+ self.sendBoolResult( false, result );
+ }
+ });
+ case SFSpeechRecognizerAuthorizationStatus.denied:
+ os_log("Permission permanently denied", log: self.pluginLog, type: .info)
+ sendBoolResult( false, result );
+ case SFSpeechRecognizerAuthorizationStatus.restricted:
+ os_log("Device restriction prevented initialize", log: self.pluginLog, type: .info)
+ sendBoolResult( false, result );
+ default:
+ os_log("Has permissions continuing with setup", log: self.pluginLog, type: .debug)
+ setupSpeechRecognition(result)
+ }
+ }
+
+ fileprivate func sendBoolResult( _ value: Bool, _ result: @escaping FlutterResult) {
+ DispatchQueue.main.async {
+ result( value )
+ }
+ }
+
+ fileprivate func setupListeningSound() {
+ listeningSound = loadSound("assets/sounds/speech_to_text_listening.m4r")
+ successSound = loadSound("assets/sounds/speech_to_text_stop.m4r")
+ cancelSound = loadSound("assets/sounds/speech_to_text_cancel.m4r")
+ }
+
+ fileprivate func loadSound( _ assetPath: String ) -> AVAudioPlayer? {
+ var player: AVAudioPlayer? = nil
+ let soundKey = registrar.lookupKey(forAsset: assetPath )
+ guard !soundKey.isEmpty else {
+ return player
+ }
+ if let soundPath = Bundle.main.path(forResource: soundKey, ofType:nil) {
+ let soundUrl = URL(fileURLWithPath: soundPath )
+ do {
+ player = try AVAudioPlayer(contentsOf: soundUrl )
+ player?.delegate = self
+ } catch {
+ // no audio
+ }
+ }
+ return player
+ }
+
+ private func setupSpeechRecognition( _ result: @escaping FlutterResult) {
+ setupRecognizerForLocale( locale: Locale.current )
+ guard recognizer != nil else {
+ sendBoolResult( false, result );
+ return
+ }
+ recognizer?.delegate = self
+ setupListeningSound()
+
+ sendBoolResult( true, result );
+ }
+
+ private func setupRecognizerForLocale( locale: Locale ) {
+ if ( previousLocale == locale ) {
+ return
+ }
+ previousLocale = locale
+ recognizer = SFSpeechRecognizer( locale: locale )
+ }
+
+ private func getLocale( _ localeStr: String? ) -> Locale {
+ guard let aLocaleStr = localeStr else {
+ return Locale.current
+ }
+ let locale = Locale(identifier: aLocaleStr)
+ return locale
+ }
+
+ private func stopSpeech( _ result: @escaping FlutterResult) {
+ if ( !listening ) {
+ sendBoolResult( false, result );
+ return
+ }
+ stopAllPlayers()
+ if let sound = successSound {
+ onPlayEnd = {() -> Void in
+ self.currentTask?.finish()
+ self.stopCurrentListen( )
+ self.sendBoolResult( true, result )
+ return
+ }
+ sound.play()
+ }
+ else {
+ stopCurrentListen( )
+ sendBoolResult( true, result );
+ }
+ }
+
+ private func cancelSpeech( _ result: @escaping FlutterResult) {
+ if ( !listening ) {
+ sendBoolResult( false, result );
+ return
+ }
+ stopAllPlayers()
+ if let sound = cancelSound {
+ onPlayEnd = {() -> Void in
+ self.currentTask?.cancel()
+ self.stopCurrentListen( )
+ self.sendBoolResult( true, result )
+ return
+ }
+ sound.play()
+ }
+ else {
+ self.currentTask?.cancel()
+ stopCurrentListen( )
+ sendBoolResult( true, result );
+ }
+ }
+
+ private func stopAllPlayers() {
+ cancelSound?.stop()
+ successSound?.stop()
+ listeningSound?.stop()
+ }
+
+ private func stopCurrentListen( ) {
+ stopAllPlayers()
+ currentRequest?.endAudio()
+
+ do {
+ try trap {
+ self.audioEngine.stop()
+ }
+ }
+ catch {
+ os_log("Error stopping engine: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription)
+ }
+ do {
+ try trap {
+ let inputNode = self.audioEngine.inputNode
+ inputNode.removeTap(onBus: self.busForNodeTap);
+ }
+ }
+ catch {
+ os_log("Error removing trap: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription)
+ }
+ do {
+ if let rememberedAudioCategory = rememberedAudioCategory {
+ try self.audioSession.setCategory(rememberedAudioCategory)
+ }
+ }
+ catch {
+ os_log("Error stopping listen: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription)
+ }
+ do {
+ try self.audioSession.setActive(false, options: .notifyOthersOnDeactivation)
+ }
+ catch {
+ os_log("Error deactivation: %{PUBLIC}@", log: pluginLog, type: .info, error.localizedDescription)
+ }
+ currentRequest = nil
+ currentTask = nil
+ onPlayEnd = nil
+ listening = false
+ }
+
+ private func listenForSpeech( _ result: @escaping FlutterResult, localeStr: String?, partialResults: Bool, onDevice: Bool, listenMode: ListenMode ) {
+ if ( nil != currentTask || listening ) {
+ sendBoolResult( false, result );
+ return
+ }
+ do {
+ // let inErrorTest = true
+ failedListen = false
+ returnPartialResults = partialResults
+ setupRecognizerForLocale(locale: getLocale(localeStr))
+ guard let localRecognizer = recognizer else {
+ result(FlutterError( code: SpeechToTextErrors.noRecognizerError.rawValue,
+ message:"Failed to create speech recognizer",
+ details: nil ))
+ return
+ }
+ if ( onDevice ) {
+ if #available(iOS 13.0, *), !localRecognizer.supportsOnDeviceRecognition {
+ result(FlutterError( code: SpeechToTextErrors.onDeviceError.rawValue,
+ message:"on device recognition is not supported on this device",
+ details: nil ))
+ }
+ }
+ rememberedAudioCategory = self.audioSession.category
+ try self.audioSession.setCategory(AVAudioSession.Category.playAndRecord, options: .defaultToSpeaker)
+ // try self.audioSession.setMode(AVAudioSession.Mode.measurement)
+ try self.audioSession.setMode(AVAudioSession.Mode.default)
+ try self.audioSession.setActive(true, options: .notifyOthersOnDeactivation)
+ if let sound = listeningSound {
+ self.onPlayEnd = {()->Void in
+ if ( !self.failedListen ) {
+ self.listening = true
+ self.invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.listening.rawValue )
+
+ }
+ }
+ sound.play()
+ }
+ self.audioEngine.reset();
+ let inputNode = self.audioEngine.inputNode
+ if(inputNode.inputFormat(forBus: 0).channelCount == 0){
+ throw SpeechToTextError.runtimeError("Not enough available inputs.")
+ }
+ self.currentRequest = SFSpeechAudioBufferRecognitionRequest()
+ guard let currentRequest = self.currentRequest else {
+ sendBoolResult( false, result );
+ return
+ }
+ currentRequest.shouldReportPartialResults = true
+ if #available(iOS 13.0, *), onDevice {
+ currentRequest.requiresOnDeviceRecognition = true
+ }
+ switch listenMode {
+ case ListenMode.dictation:
+ currentRequest.taskHint = SFSpeechRecognitionTaskHint.dictation
+ break
+ case ListenMode.search:
+ currentRequest.taskHint = SFSpeechRecognitionTaskHint.search
+ break
+ case ListenMode.confirmation:
+ currentRequest.taskHint = SFSpeechRecognitionTaskHint.confirmation
+ break
+ default:
+ break
+ }
+ self.currentTask = self.recognizer?.recognitionTask(with: currentRequest, delegate: self )
+ let recordingFormat = inputNode.outputFormat(forBus: self.busForNodeTap)
+ try trap {
+ inputNode.installTap(onBus: self.busForNodeTap, bufferSize: self.speechBufferSize, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
+ currentRequest.append(buffer)
+ self.updateSoundLevel( buffer: buffer )
+ }
+ }
+ // if ( inErrorTest ){
+ // throw SpeechToTextError.runtimeError("for testing only")
+ // }
+ self.audioEngine.prepare()
+ try self.audioEngine.start()
+ if nil == listeningSound {
+ listening = true
+ self.invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.listening.rawValue )
+ }
+ sendBoolResult( true, result );
+ }
+ catch {
+ failedListen = true
+ os_log("Error starting listen: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription)
+ stopCurrentListen()
+ sendBoolResult( false, result );
+ invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.notListening.rawValue )
+ let speechError = SpeechRecognitionError(errorMsg: "error_listen_failed", permanent: true )
+ do {
+ let errorResult = try jsonEncoder.encode(speechError)
+ invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyError, arguments: String( data:errorResult, encoding: .utf8) )
+ } catch {
+ os_log("Could not encode JSON", log: pluginLog, type: .error)
+ }
+ }
+ }
+
+ private func updateSoundLevel( buffer: AVAudioPCMBuffer) {
+ guard
+ let channelData = buffer.floatChannelData
+ else {
+ return
+ }
+
+ let channelDataValue = channelData.pointee
+ let channelDataValueArray = stride(from: 0,
+ to: Int(buffer.frameLength),
+ by: buffer.stride).map{ channelDataValue[$0] }
+ let frameLength = Float(buffer.frameLength)
+ let rms = sqrt(channelDataValueArray.map{ $0 * $0 }.reduce(0, +) / frameLength )
+ let avgPower = 20 * log10(rms)
+ self.invokeFlutter( SwiftSpeechToTextCallbackMethods.soundLevelChange, arguments: avgPower )
+ }
+
+ /// Build a list of localId:name with the current locale first
+ private func locales( _ result: @escaping FlutterResult ) {
+ var localeNames = [String]();
+ let locales = SFSpeechRecognizer.supportedLocales();
+ let currentLocale = Locale.current
+ if let idName = buildIdNameForLocale(forIdentifier: currentLocale.identifier ) {
+ localeNames.append(idName)
+ }
+ for locale in locales {
+ if ( locale.identifier == currentLocale.identifier) {
+ continue
+ }
+ if let idName = buildIdNameForLocale(forIdentifier: locale.identifier ) {
+ localeNames.append(idName)
+ }
+ }
+ DispatchQueue.main.async {
+ result(localeNames)
+ }
+ }
+
+ private func buildIdNameForLocale( forIdentifier: String ) -> String? {
+ var idName: String?
+ if let name = Locale.current.localizedString(forIdentifier: forIdentifier ) {
+ let sanitizedName = name.replacingOccurrences(of: ":", with: " ")
+ idName = "\(forIdentifier):\(sanitizedName)"
+ }
+ return idName
+ }
+
+ private func handleResult( _ transcriptions: [SFTranscription], isFinal: Bool ) {
+ if ( !isFinal && !returnPartialResults ) {
+ return
+ }
+ var speechWords: [SpeechRecognitionWords] = []
+ for transcription in transcriptions {
+ let words: SpeechRecognitionWords = SpeechRecognitionWords(recognizedWords: transcription.formattedString, confidence: confidenceIn( transcription))
+ speechWords.append( words )
+ }
+ let speechInfo = SpeechRecognitionResult(alternates: speechWords, finalResult: isFinal )
+ do {
+ let speechMsg = try jsonEncoder.encode(speechInfo)
+ if let speechStr = String( data:speechMsg, encoding: .utf8) {
+ os_log("Encoded JSON result: %{PUBLIC}@", log: pluginLog, type: .debug, speechStr )
+ invokeFlutter( SwiftSpeechToTextCallbackMethods.textRecognition, arguments: speechStr )
+ }
+ } catch {
+ os_log("Could not encode JSON", log: pluginLog, type: .error)
+ }
+ }
+
+ private func confidenceIn( _ transcription: SFTranscription ) -> Decimal {
+ guard ( transcription.segments.count > 0 ) else {
+ return 0;
+ }
+ var totalConfidence: Float = 0.0;
+ for segment in transcription.segments {
+ totalConfidence += segment.confidence
+ }
+ let avgConfidence: Float = totalConfidence / Float(transcription.segments.count )
+ let confidence: Float = (avgConfidence * 1000).rounded() / 1000
+ return Decimal( string: String( describing: confidence ) )!
+ }
+
+ private func invokeFlutter( _ method: SwiftSpeechToTextCallbackMethods, arguments: Any? ) {
+ DispatchQueue.main.async {
+ self.channel.invokeMethod( method.rawValue, arguments: arguments )
+ }
+ }
+
+}
+
+@available(iOS 10.0, *)
+extension SwiftSpeechToTextPlugin : SFSpeechRecognizerDelegate {
+ public func speechRecognizer(_ speechRecognizer: SFSpeechRecognizer, availabilityDidChange available: Bool) {
+ let availability = available ? SpeechToTextStatus.available.rawValue : SpeechToTextStatus.unavailable.rawValue
+ os_log("Availability changed: %{PUBLIC}@", log: pluginLog, type: .debug, availability)
+ invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: availability )
+ }
+}
+
+@available(iOS 10.0, *)
+extension SwiftSpeechToTextPlugin : SFSpeechRecognitionTaskDelegate {
+ public func speechRecognitionDidDetectSpeech(_ task: SFSpeechRecognitionTask) {
+ // Do nothing for now
+ }
+
+ public func speechRecognitionTaskFinishedReadingAudio(_ task: SFSpeechRecognitionTask) {
+ reportError(source: "FinishedReadingAudio", error: task.error)
+ invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.notListening.rawValue )
+ }
+
+ public func speechRecognitionTaskWasCancelled(_ task: SFSpeechRecognitionTask) {
+ reportError(source: "TaskWasCancelled", error: task.error)
+ invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.notListening.rawValue )
+ }
+
+ public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishSuccessfully successfully: Bool) {
+ reportError(source: "FinishSuccessfully", error: task.error)
+ stopCurrentListen( )
+ }
+
+ public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didHypothesizeTranscription transcription: SFTranscription) {
+ reportError(source: "HypothesizeTranscription", error: task.error)
+ handleResult( [transcription], isFinal: false )
+ }
+
+ public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishRecognition recognitionResult: SFSpeechRecognitionResult) {
+ reportError(source: "FinishRecognition", error: task.error)
+ let isFinal = recognitionResult.isFinal
+ handleResult( recognitionResult.transcriptions, isFinal: isFinal )
+ }
+
+ private func reportError( source: String, error: Error?) {
+ if ( nil != error) {
+ os_log("%{PUBLIC}@ with error: %{PUBLIC}@", log: pluginLog, type: .debug, source, error.debugDescription)
+ }
+ }
+}
+
+@available(iOS 10.0, *)
+extension SwiftSpeechToTextPlugin : AVAudioPlayerDelegate {
+
+ public func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer,
+ successfully flag: Bool) {
+ if let playEnd = self.onPlayEnd {
+ playEnd()
+ }
+ }
+}
diff --git a/speech_to_text_/ios/speech_to_text.podspec b/speech_to_text_/ios/speech_to_text.podspec
new file mode 100644
index 00000000..1db79aa0
--- /dev/null
+++ b/speech_to_text_/ios/speech_to_text.podspec
@@ -0,0 +1,22 @@
+#
+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
+#
+Pod::Spec.new do |s|
+ s.name = 'speech_to_text'
+ s.version = '0.0.1'
+ s.summary = 'A new flutter plugin project.'
+ s.description = <<-DESC
+A new flutter plugin project.
+ DESC
+ s.homepage = 'http://example.com'
+ s.license = { :file => '../LICENSE' }
+ s.author = { 'Your Company' => 'email@example.com' }
+ s.source = { :path => '.' }
+ s.source_files = 'Classes/**/*'
+ s.public_header_files = 'Classes/**/*.h'
+ s.dependency 'Flutter'
+ s.dependency 'Try'
+
+ s.ios.deployment_target = '8.0'
+end
+