I want to add a translation function in flutter development, but it doesn't work

I want to add a translation function in flutter development, but it doesn’t work.

  void _translateEngToThai() async{
    final request = CompleteText(
        prompt: translateEngToThai(word: inputText),
        maxTokens: 200,
        model: TextDavinci3Model());
    final response = await openAI.onCompletion(request: request);
    //cancel request
    //openAI.cancelAIGenerate();
    setState(() {
      _translatedText = response as String;
    });
  }

I commented out the openAI.cancelAIGenerate(); line because I got the error The method ‘cancelAIGenerate’ isn’t defined for the type ‘OpenAI’.

I’m sorry if I’m using the forum incorrectly as this is my first post.

Welcome to the forum!

You don’t need to include [First post] in the title. When others view your topic, they see:

I’m fixing the title for you. :slightly_smiling_face:

1 Like