subscribeToEvents method
Future<EntitySubscription<Device> >
subscribeToEvents(
- String sdkId,
- Set<
SubscriptionEventType> events, - FilterOptions<
Device> filter, - EntitySubscriptionConfiguration? subscriptionConfig,
Implementation
Future<EntitySubscription<Device>> subscribeToEvents(String sdkId, Set<SubscriptionEventType> events, FilterOptions<Device> filter, EntitySubscriptionConfiguration? subscriptionConfig) async {
final res = await _methodChannel.invokeMethod<String>(
'DeviceApi.subscribeToEvents',
{
"sdkId": sdkId,
"events": jsonEncode(events.map((x0) => SubscriptionEventType.encode(x0)).toList()),
"filter": jsonEncode(FilterOptions.encode(filter)),
"subscriptionConfig": jsonEncode(subscriptionConfig == null ? null : EntitySubscriptionConfiguration.encode(subscriptionConfig!)),
}
);
if (res == null) throw AssertionError("received null result from platform method subscribeToEvents");
final parsedResJson = jsonDecode(res);
return EntitySubscription(parsedResJson, (x0) => Device.fromJSON(x0));
}