decodeOfferedField function

List<String> decodeOfferedField(
  1. String? encoded
)

Decodes kAgentFailureOfferedField; an absent or unparseable value is the EMPTY catalog, never a throw — diagnostic evidence may not break a failure report that is already on its way to the engine.

Implementation

List<String> decodeOfferedField(String? encoded) {
  if (encoded == null || encoded.isEmpty) return const <String>[];
  try {
    final decoded = jsonDecode(encoded);
    return decoded is List
        ? <String>[
            for (final id in decoded)
              if (id is String) id,
          ]
        : const <String>[];
  } on Object {
    return const <String>[];
  }
}