acceptStream method

dynamic acceptStream(
  1. dynamic response
)

Implementation

acceptStream(var response) async {
  if (response == null) {
    return;
  }
  response = response.toString().replaceAll('notification:', '').trim();
  var notification = AtNotification.fromJson(jsonDecode(response));
  _logger.info(
      'Received notification:: id:${notification.id} key:${notification.key} operation:${notification.operation} from:${notification.fromAtSign} to:${notification.toAtSign}');
  if (notification.operation == Operation.update &&
      notification.toAtSign == _sdkService.atsign &&
      notification.key!.contains(AppConstants.containsFollowing)) {
    await updateFollowers(notification);
  } else if (notification.operation == Operation.delete &&
      notification.toAtSign == _sdkService.atsign &&
      notification.key!.contains(AppConstants.containsFollowing)) {
    await deleteFollowers(notification);
  } else if (notification.operation == Operation.delete &&
      notification.toAtSign == _sdkService.atsign &&
      notification.key!.contains(AppConstants.containsFollowers)) {
    await deleteFollowing(notification);
  }
}