Android - error: The argument type '() → void' can't be assigned to the parameter type '(String) → void'.
Hi, I tried to import the project in Android studio, the project sync working fine, after the compiler error displayed,
error: The argument type '() → void' can't be assigned to the parameter type '(String) → void'. (argument_type_not_assignable at [speech_recognition_example] lib\main.dart:53)
Compiler message: lib/main.dart:53:43: Error: The argument type 'void Function()' can't be assigned to the parameter type 'void Function(String)'. Try changing the type of the parameter, or casting the argument to 'void Function(String)'. _speech.setRecognitionCompleteHandler(onRecognitionComplete);
Hey @SHAKTHI62
See here - https://github.com/rxlabz/speech_recognition/pull/29/files#diff-d9a718a3042c2ebab14df5f34ef46a52R53 - to check how to fix the example project
Hi @vintage , Thank you so much for your update. The issue is fixed, but i how can compile the flutter plugin project and run the example flutter project. I run the example project "Program linking failed." error message displayed.
- Clone the repo
- Open it with Android Studio
- Open
pubspec.yamland at the top click onPackages get - Start the emulator
- Click on
Playbutton to build & run the example app
That's it - should build and run the example app on your emulator. Can you provide the logs with error?
Thank you for your information. Example work great now
You just need to replace this _speech.setRecognitionCompleteHandler(onRecognitionComplete); to
_speech.setRecognitionCompleteHandler((_) => onRecognitionComplete());.
The error will go automatically. @SHAKTHI62
All Possible Solution added here [Solved] The argument type ‘Future’ can’t be assigned to the parameter type ‘void Function()’