resolveAgents method

List<FakeAgent> resolveAgents(
  1. JsonMap body
)

The agents of the resolve_i1 of body, in ascending ID (10 11: the server authorizes them in ascending id); none without resolve_i1.

Throws 404 not_found for an ID that is not an agent, before anything is written.

Implementation

List<FakeAgent> resolveAgents(JsonMap body) {
  final resolve = body['resolve_i1'] as JsonMap?;
  if (resolve == null) return const [];
  final ids = [
    for (final id in resolve['switch_to_organization']! as List) id as String,
  ]..sort();
  return [
    for (final id in ids)
      world.agentOf(id) ?? (throw const FakeProblem(404, 'not_found')),
  ];
}