decode method

  1. @override
SessionConfigSelectOptions decode(
  1. Object? value
)
override

Decodes a JSON-compatible wire value.

Implementation

@override
SessionConfigSelectOptions decode(Object? value) {
  if (value is List<Object?>) {
    try {
      return SessionConfigSelectOptionsUngrouped(
        List<SessionConfigSelectOption>.unmodifiable(
          value.map((item) => sessionConfigSelectOptionCodec.decode(item)),
        ),
      );
    } on Object {
      // Try the next array-shaped member.
    }
  }
  if (value is List<Object?>) {
    try {
      return SessionConfigSelectOptionsGrouped(
        List<SessionConfigSelectGroup>.unmodifiable(
          value.map((item) => sessionConfigSelectGroupCodec.decode(item)),
        ),
      );
    } on Object {
      // Try the next array-shaped member.
    }
  }
  throw const FormatException(
    'Value does not match SessionConfigSelectOptions',
  );
}