google-translator
google-translator copied to clipboard
Getting Null for the translated output
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); }); }
Have you tried using async/await
? Also, verify internet connection.
Yes. But it looks like Google is giving the null. Maybe because they are charging $20/M Char.
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.
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
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