topicSubscribe static method
void
topicSubscribe(
- List<
String> params, - dynamic onSuccess()?,
- dynamic onError(
- ErrorModel error
Subscribe to Topics
topics Array of Topics
to subscribe
Callback to get Topic's list
Throw ErrorModel if there is some error during the processs
Implementation
static void topicSubscribe(
List<String> params,
Function(List<Topic> topic)? onSuccess,
Function(ErrorModel error)? onError) async {
_indigitall
.invokeMapMethod(_ACTION_TOPICS_SUBSCRIBE, params)
.then((value) => {
if (value != null)
{
value.forEach((key, valueMap) {
if (key == _CALLBACK_TOPIC_SUBSCRIBE) {
if (onSuccess != null)
onSuccess(Topic.createArray(valueMap));
}
})
}
})
.catchError((error) => {
if (error is PlatformException)
{
if (onError != null)
onError(ErrorModel(error.code, error.message))
}
});
}