invokeSync method

Map invokeSync({
  1. required Map parameters,
  2. bool isThrowOnError = true,
})

call api latest Tdlib-Methods example:

tg.invokeSync(
 "parseTextEntities",
 parameters: {
   "parse_mode": {
     "@type": "textParseModeHTML",
    },
   "text": text
  },
  clientId: tg.client_id,
);

Implementation

Map invokeSync({
  required Map parameters,
  bool isThrowOnError = true,
}) {
  Map result = td_execute(parameters);
  if (result["@type"] == "error") {
    if (!isThrowOnError) {
      return result;
    }
    result["invoke_request"] = parameters;
    throw result;
  }
  return result;
}