watch method

Future<Stream<List<NotificationObject>>?> watch(
  1. String database, {
  2. Map? filter,
})

Return result not included nested object / list

Implementation

Future<Stream<List<NotificationObject>>?> watch(String database,
    {Map? filter}) async {
  assert(_partition.length != 0);

  // Subscribe into manager
  NotificationManager manager = NotificationManager.instance(_channel)!;
  manager.addCallHandler(uniqueListenerId, this);

  Map<dynamic, dynamic> map =
      await _channel.invokeMethod(Action.watch.name, <String, dynamic>{
    'listenId': uniqueListenerId,
    'collection': T.toString(),
    'database': database,
    'filter': filter,
    'identity': _syncUser.identity,
    'appId': _appId,
  });
  if (map["error"] != null) {
    throw Exception("fetch list finished with exception ${map["error"]}");
  }

  _streamController = new StreamController<List<NotificationObject>>();
  return _streamController?.stream;
}