I am making a text translation application using Flutter which is supposed to read the text from an input text file and then translate it into a selected language and displaly it.
My code works but I am having to close and restart the application everytime I change the text in the input file for the application to load in the new text. How to make the application read and load the new text if I change the text in the file?
I used the below:
`getData() async {
String response;
response = await rootBundle.loadString('assets/trans_input.txt');
setState(() {
userinput = response;
});
}
//Translate
resultTranslate() async {
String response;
response = await rootBundle.loadString('assets/trans_input.txt');
setState(() {
userinput = response;
print(response);
});
setState(() {
result = translation.text;
tts.speak(result);
});`