createArray static method

List<Topic> createArray(
  1. dynamic topics
)

Get a list of topic

Implementation

static List<Topic> createArray(dynamic topics) {
  List<dynamic> list = topics;
  List<Topic> topicList = [];
  for (int i = 0; i < list.length; i++) {
    Topic? topic = new Topic(null);
    list[i].forEach((key, value) {
      if (key == _JSON_CODE) topic.code = value.toString();
      if (key == _JSON_NAME) topic.name = value.toString();
      if (key == _JSON_VISIBLE) topic.visible = value.toString() == "true";
      if (key == _JSON_SUBSCRIBED)
        topic.subscribed = value.toString() == "true";
    });
    topicList.add(topic);
  }
  return topicList;
}