getChannelVar method

dynamic getChannelVar(
  1. dynamic callback(
    1. bool,
    2. dynamic
    ),
  2. String variable
)

Implementation

getChannelVar(Function(bool, dynamic) callback, String variable) {
  var resp = ChannelsApi.getChannelVariable(id, variable);
  resp.then((value) {
    print("Channel variable: ${value.resp}");
    //var varJson = jsonDecode(value.resp);
    //throw "You need to see cahnnel Variable";
    if (value.resp == '{"message":"Provided variable was not found"}') {
      callback(true, value.resp);
    } else {
      //callback(false, value.resp);
      throw value.resp;
    }
  });
}