translate method
Implementation
Future<TranslationResult> translate(
String text, String source, String target) async {
String token = this.iamOptions.accessToken;
modelId = source + "-" + target;
var response = await http.post(
_getUrl("translate"),
headers: {
HttpHeaders.authorizationHeader: "Bearer $token",
HttpHeaders.acceptHeader: "application/json",
HttpHeaders.contentTypeHeader: "application/json",
},
body: '{\"text\":[\"$text\"],\"model_id\":\"$modelId\"}',
).timeout(const Duration(seconds: 360));
return new TranslationResult(json.decode(response.body));
}