void update(Channel channel)

Updates a channel stored in the channel list. Removes it, if it is destroyed, adds it when it is created and merely updates the information associated with channel (variables and fields) with the new information.

Source

void update(Channel channel) {
  if (!_channelStorage.containsKey(channel.uuid)) {
    _add(channel);
  } else {
    Channel oldChannel = _channelStorage[channel.uuid];

    if (channel.variables.isEmpty) {
      _channelStorage[channel.uuid] =
          new Channel.assemble(channel.fields, oldChannel.variables);
    } else {
      _channelStorage[channel.uuid] = channel;
    }
  }

  if (channel.state == _ChannelState._destroy) {
    _remove(channel);
  }
}