updateModel method

void updateModel()

Implementation

void updateModel() {
  widget.model.listMessages?.add(
      ListMessage(
          isAI: _messages[0].isAI,
          message: _messages[0].message,
          time: _messages[0].time
      )
  );

  try {
    MethodChannel channel = MethodChannel(channelName);
    String jsonResult = jsonEncode(widget.model.toJson());
    channel.invokeMethod("updateModel", jsonResult);
  } on MissingPluginException catch (e) {
    IPrint("updateModel not implemented $e");
  }

}