translateText method

  1. @override
Future<V2TimValueCallback<Map<String, String>>> translateText({
  1. required List<String> texts,
  2. required String targetLanguage,
  3. String? sourceLanguage,
})
override

Implementation

@override
Future<V2TimValueCallback<Map<String, String>>> translateText({
  required List<String> texts,
  required String targetLanguage,
  String? sourceLanguage,
}) async {
  Map<String, dynamic> param = {
    "texts": texts,
    "targetLanguage": targetLanguage,
    "sourceLanguage": sourceLanguage ?? "auto",
  };
  var resp = V2TimValueCallback<Map<String, String>>.fromJson(
    formatJson(
      await _channel.invokeMethod(
        "translateText",
        buildMessageMangerParam(
          param,
        ),
      ),
    ),
  );
  log("translateText", param, resp.toLogString());
  return resp;
}