google-translator icon indicating copy to clipboard operation
google-translator copied to clipboard

Getting Null for the translated output

Open carlfost opened this issue 4 years ago • 5 comments

I am getting null for any input words. Here is the code segment:

GoogleTranslator translator = GoogleTranslator(); //using google translator

String out; final lang = TextEditingController(); //getting text

void trans() { translator.translate(lang.text, to: 'fr') .then((output) { setState(() { out = output; //placing the translated text to the String to be used }); print(out); }); }

carlfost avatar Jul 13 '20 14:07 carlfost

Have you tried using async/await? Also, verify internet connection.

gabrielpacheco23 avatar Jul 16 '20 21:07 gabrielpacheco23

Yes. But it looks like Google is giving the null. Maybe because they are charging $20/M Char.

carlfost avatar Jul 20 '20 00:07 carlfost

Yes. But it looks like Google is giving the null. Maybe because they are charging $20/M Char.

Thats weird. I tested your code and it worked for me.

gabrielpacheco23 avatar Jul 29 '20 17:07 gabrielpacheco23

setState(() { out = output; //placing the translated text to the String to be used }); You can't pass the value from output(Translation) to out (String), the whole code can't run . The example code return error code 429

DangKhoi1997 avatar Aug 19 '20 02:08 DangKhoi1997

The issue is due to the unusual traffic on your network you can test on different network I have observed it but we can't depend on this package as at any point of time we may break. If possible bro please take look on this it will be helpful for many of the developers to use your package

ag12216 avatar Dec 23 '20 04:12 ag12216