speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

Android - error: The argument type '() → void' can't be assigned to the parameter type '(String) → void'.

Open SHAKTHI62 opened this issue 6 years ago • 6 comments

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);

SHAKTHI62 avatar May 07 '19 08:05 SHAKTHI62

Hey @SHAKTHI62

See here - https://github.com/rxlabz/speech_recognition/pull/29/files#diff-d9a718a3042c2ebab14df5f34ef46a52R53 - to check how to fix the example project

vintage avatar May 09 '19 14:05 vintage

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.

SHAKTHI62 avatar May 10 '19 05:05 SHAKTHI62

  1. Clone the repo
  2. Open it with Android Studio
  3. Open pubspec.yaml and at the top click on Packages get
  4. Start the emulator
  5. Click on Play button 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?

vintage avatar May 10 '19 10:05 vintage

Thank you for your information. Example work great now

chunhunghan avatar Jun 06 '19 05:06 chunhunghan

You just need to replace this _speech.setRecognitionCompleteHandler(onRecognitionComplete); to _speech.setRecognitionCompleteHandler((_) => onRecognitionComplete());.

The error will go automatically. @SHAKTHI62

ratnapriya4g avatar Jul 04 '20 12:07 ratnapriya4g