diff --git a/binding/flutter/CHANGELOG.md b/binding/flutter/CHANGELOG.md index e544ada25..0f19090d7 100644 --- a/binding/flutter/CHANGELOG.md +++ b/binding/flutter/CHANGELOG.md @@ -55,4 +55,7 @@ * Improved error reporting ## [3.0.1] - 2023-11-17 -* Update native packages \ No newline at end of file +* Update native packages + +## [3.0.2] - 2024-01-15 +* Address locale issue diff --git a/binding/flutter/android/src/main/java/ai/picovoice/flutter/porcupine/PorcupinePlugin.java b/binding/flutter/android/src/main/java/ai/picovoice/flutter/porcupine/PorcupinePlugin.java index edf9d5dec..fc49d9b77 100644 --- a/binding/flutter/android/src/main/java/ai/picovoice/flutter/porcupine/PorcupinePlugin.java +++ b/binding/flutter/android/src/main/java/ai/picovoice/flutter/porcupine/PorcupinePlugin.java @@ -1,5 +1,5 @@ // -// Copyright 2020-2023 Picovoice Inc. +// Copyright 2020-2024 Picovoice Inc. // // You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" // file accompanying this source. @@ -53,7 +53,7 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBindin public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { Method method; try { - method = Method.valueOf(call.method.toUpperCase()); + method = Method.valueOf(call.method); } catch (IllegalArgumentException e) { result.error( PorcupineRuntimeException.class.getSimpleName(), diff --git a/binding/flutter/ios/Classes/SwiftPorcupinePlugin.swift b/binding/flutter/ios/Classes/SwiftPorcupinePlugin.swift index dc1a3186c..26b2d480e 100644 --- a/binding/flutter/ios/Classes/SwiftPorcupinePlugin.swift +++ b/binding/flutter/ios/Classes/SwiftPorcupinePlugin.swift @@ -1,5 +1,5 @@ // -// Copyright 2020-2023 Picovoice Inc. +// Copyright 2020-2024 Picovoice Inc. // // You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" // file accompanying this source. @@ -33,7 +33,7 @@ public class SwiftPorcupinePlugin: NSObject, FlutterPlugin { } public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - guard let method = Method(rawValue: call.method.uppercased()) else { + guard let method = Method(rawValue: call.method) else { result(errorToFlutterError( PorcupineRuntimeError("Porcupine method '\(call.method)' is not a valid function"))) return diff --git a/binding/flutter/lib/porcupine.dart b/binding/flutter/lib/porcupine.dart index cbed980ca..a3d4c0b71 100644 --- a/binding/flutter/lib/porcupine.dart +++ b/binding/flutter/lib/porcupine.dart @@ -1,5 +1,5 @@ // -// Copyright 2020-2023 Picovoice Inc. +// Copyright 2020-2024 Picovoice Inc. // // You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" // file accompanying this source. @@ -48,6 +48,17 @@ enum BuiltInKeyword { TERMINATOR } +enum _NativeFunctions { + // ignore:constant_identifier_names + FROM_BUILTIN_KEYWORDS, + // ignore:constant_identifier_names + FROM_KEYWORD_PATHS, + // ignore:constant_identifier_names + PROCESS, + // ignore:constant_identifier_names + DELETE +} + class Porcupine { static final MethodChannel _channel = MethodChannel("porcupine"); @@ -101,7 +112,7 @@ class Porcupine { try { Map result = Map.from( - await _channel.invokeMethod('from_builtin_keywords', { + await _channel.invokeMethod(_NativeFunctions.FROM_BUILTIN_KEYWORDS.name, { 'accessKey': accessKey, 'modelPath': modelPath, 'keywords': keywordValues, @@ -146,7 +157,7 @@ class Porcupine { try { Map result = Map.from( - await _channel.invokeMethod('from_keyword_paths', { + await _channel.invokeMethod(_NativeFunctions.FROM_KEYWORD_PATHS.name, { 'accessKey': accessKey, 'modelPath': modelPath, 'keywordPaths': keywordPaths, @@ -175,7 +186,7 @@ class Porcupine { Future process(List? frame) async { try { int keywordIndex = await _channel - .invokeMethod('process', {'handle': _handle, 'frame': frame}); + .invokeMethod(_NativeFunctions.PROCESS.name, {'handle': _handle, 'frame': frame}); return keywordIndex; } on PlatformException catch (error) { @@ -188,7 +199,7 @@ class Porcupine { /// Frees memory that was allocated for Porcupine Future delete() async { if (_handle != null) { - await _channel.invokeMethod('delete', {'handle': _handle}); + await _channel.invokeMethod(_NativeFunctions.DELETE.name, {'handle': _handle}); _handle = null; } } diff --git a/binding/flutter/pubspec.lock b/binding/flutter/pubspec.lock index 5e8d34cc8..09866d097 100644 --- a/binding/flutter/pubspec.lock +++ b/binding/flutter/pubspec.lock @@ -42,14 +42,14 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.16.0" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.2.0" ffi: dependency: transitive description: @@ -95,13 +95,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.4" meta: dependency: transitive description: @@ -115,7 +108,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" path_provider: dependency: "direct main" description: @@ -197,7 +190,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -232,14 +225,21 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.3" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.1" win32: dependency: transitive description: @@ -255,5 +255,5 @@ packages: source: hosted version: "0.2.0" sdks: - dart: ">=2.17.0-0 <3.0.0" + dart: ">=2.14.0 <3.0.0" flutter: ">=2.8.1" diff --git a/binding/flutter/pubspec.yaml b/binding/flutter/pubspec.yaml index 31f46d7ae..f3e5111b8 100644 --- a/binding/flutter/pubspec.yaml +++ b/binding/flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: porcupine_flutter description: A Flutter plugin for Picovoice's Porcupine offline wake word engine. -version: 3.0.1 +version: 3.0.2 homepage: https://picovoice.ai/ repository: https://github.com/Picovoice/porcupine/ documentation: https://picovoice.ai/docs/porcupine/ diff --git a/demo/flutter/pubspec.lock b/demo/flutter/pubspec.lock index 78b0c9239..8482c05e4 100644 --- a/demo/flutter/pubspec.lock +++ b/demo/flutter/pubspec.lock @@ -1,70 +1,83 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.6" async: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.11.0" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.0" characters: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.2.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.0" collection: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.dev" + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" source: hosted - version: "1.18.0" + version: "3.0.1" fake_async: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.2.0" ffi: dependency: transitive description: name: ffi - sha256: "13a6ccf6a459a125b3fcdb6ec73bd5ff90822e071207c663bfd1f70062d51d18" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.1" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "6.1.4" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -79,8 +92,7 @@ packages: dependency: "direct main" description: name: flutter_picker - sha256: "2f94c6eefba8697b07e3cd008b75f06b4ba7053cb26d23ae0fcd5932b7dc75af" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" flutter_test: @@ -92,8 +104,7 @@ packages: dependency: transitive description: name: flutter_voice_processor - sha256: fb511a2f0ca9540c4b7c6715515389d27b5bbd332138ab3a300078fb243a0caf - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" fuchsia_remote_debug_protocol: @@ -110,128 +121,105 @@ packages: dependency: "direct dev" description: name: lints - sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.16" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" - url: "https://pub.dev" - source: hosted - version: "0.5.0" + version: "0.12.11" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.10.0" + version: "1.7.0" path: dependency: "direct main" description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.8.3" + version: "1.8.0" path_provider: dependency: transitive description: name: path_provider - sha256: "050e8e85e4b7fecdf2bb3682c1c64c4887a183720c802d323de8a5fd76d372dd" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "4d5542667150f5b779ba411dd5dc0b674a85d1355e45bda2877e0e82f4ad08d8" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.20" path_provider_ios: dependency: transitive description: name: path_provider_ios - sha256: "03d639406f5343478352433f00d3c4394d52dac8df3d847869c5e2333e0bbce8" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos - sha256: "2a97e7fbb7ae9dcd0dfc1220a78e9ec3e71da691912e617e8715ff2a13086ae8" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "27dc7a224fcd07444cb5e0e60423ccacea3e13cf00fc5282ac2c918132da931d" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: a34ecd7fb548f8e57321fd8e50d865d266941b54e6c3b7758cf8f37c24116905 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.7" platform: dependency: transitive description: name: platform - sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.0.2" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.3" porcupine_flutter: dependency: "direct main" description: name: porcupine_flutter - sha256: "54418cfc65172d56fd45deb246eb9f4ca1589f8d00c288e8eb9a0b4240d601f1" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" process: dependency: transitive description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "4.2.4" sky_engine: @@ -243,106 +231,93 @@ packages: dependency: transitive description: name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.10.0" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.1.0" sync_http: dependency: transitive description: name: sync_http - sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.3.0" term_glyph: dependency: transitive description: name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.6.1" + version: "0.4.3" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.1" vm_service: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "11.10.0" - web: - dependency: transitive - description: - name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 - url: "https://pub.dev" - source: hosted - version: "0.3.0" + version: "7.3.0" webdriver: dependency: transitive description: name: webdriver - sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.0.0" win32: dependency: transitive description: name: win32 - sha256: "4658d864d83cdaedcbf3e65ad93b71880a3e8c9ee1ff15d855f88fb2da66cb8a" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.5.2" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.2.0+3" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" + dart: ">=2.15.0 <3.0.0" flutter: ">=2.8.1" diff --git a/demo/flutter/pubspec.yaml b/demo/flutter/pubspec.yaml index 985aad66a..99ebde23e 100644 --- a/demo/flutter/pubspec.yaml +++ b/demo/flutter/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: sdk: flutter flutter_picker: ^2.0.1 - porcupine_flutter: ^3.0.1 + porcupine_flutter: ^3.0.2 path: ^1.8.0 dev_dependencies: