projectionAddConfigOptionsRetainedBytes function

int projectionAddConfigOptionsRetainedBytes(
  1. int retained,
  2. ChatRetainedSizeEstimator estimator,
  3. List<ChatConfigOption> options
)

Implementation

int projectionAddConfigOptionsRetainedBytes(
  int retained,
  acp.ChatRetainedSizeEstimator estimator,
  List<ChatConfigOption> options,
) {
  retained = projectionAddRetainedListHostBytes(retained, options.length);
  for (final option in options) {
    retained = projectionCheckedRetainedAdd(
      retained,
      _configOptionHostRetainedBytes,
    );
    for (final value in <Object?>[
      option.id,
      option.name,
      option.type,
      option.currentValue,
      if (option.description != null) option.description,
      if (option.category != null) option.category,
      if (option.group != null) option.group,
    ]) {
      retained = projectionAddEstimatedRetainedBytes(
        retained,
        estimator,
        value,
      );
    }
    retained = projectionAddRetainedListHostBytes(
      retained,
      option.options.length,
    );
    for (final choice in option.options) {
      retained = projectionCheckedRetainedAdd(
        retained,
        _configChoiceHostRetainedBytes,
      );
      retained = projectionAddEstimatedRetainedBytes(
        retained,
        estimator,
        choice.value,
      );
      retained = projectionAddEstimatedRetainedBytes(
        retained,
        estimator,
        choice.name,
      );
      if (choice.description != null) {
        retained = projectionAddEstimatedRetainedBytes(
          retained,
          estimator,
          choice.description,
        );
      }
    }
  }
  return retained;
}