SpecialistPool.fromJson constructor

SpecialistPool.fromJson(
  1. Object? j
)

Implementation

factory SpecialistPool.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SpecialistPool(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    specialistManagersCount: switch (json['specialistManagersCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    specialistManagerEmails: switch (json['specialistManagerEmails']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"specialistManagerEmails" is not a list',
      ),
    },
    pendingDataLabelingJobs: switch (json['pendingDataLabelingJobs']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"pendingDataLabelingJobs" is not a list',
      ),
    },
    specialistWorkerEmails: switch (json['specialistWorkerEmails']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"specialistWorkerEmails" is not a list',
      ),
    },
  );
}