agentOf method

FakeAgent? agentOf(
  1. String agentId
)

The FakeAgent of agentId: the stored one, or a new one with the defaults for an agent person without a row; null for an unknown ID or a principal that is not an agent.

Implementation

FakeAgent? agentOf(String agentId) {
  final p = people[agentId];
  if (p == null || p.kind != 'agent') return null;
  return agents.putIfAbsent(agentId, () => FakeAgent(id: agentId));
}