Search code examples
androidiosflutterdartopenai-api

The argument type 'int' can't be assigned to the parameter type 'Duration'


I upgraded my package chat_gpt_sdk to 2.0.4 and the flutter sdk to the latest version but now i get this error The argument type 'int' can't be assigned to the parameter type 'Duration'. I need to be on this version to have access to the chatgpt turbo model. can anyone help me with this

      return 'Count: $count';
    }).take(10);

    openAI = OpenAI.instance.build(
      token: "$Apikey",
      baseOption: HttpSetup(
        receiveTimeout: 30000,
        connectTimeout: 5000,
        sendTimeout: 5000,

      ),
      isLogger: true,
    );
  }

Solution

  • You need to provide receiveTimeout , connectTimeout and sendTimeout in Duration

    baseOption: HttpSetup(
      receiveTimeout: Duration(milliseconds: 30000),
      connectTimeout: Duration(seconds: 5),
      sendTimeout: Duration(seconds: 5),
    ),