VisitorDto.fromJson constructor

VisitorDto.fromJson(
  1. Json j
)

Parses the wire shape, keeping unknown fields in raw.

Implementation

factory VisitorDto.fromJson(Json j) => VisitorDto(
  id: strOr(j, 'id'),
  siteId: strOr(j, 'site_id'),
  email: str(j, 'email'),
  name: str(j, 'name'),
  phone: str(j, 'phone'),
  avatarUrl: str(j, 'avatar_url'),
  externalId: str(j, 'external_id'),
  customData: mapOf(j, 'custom_data') ?? const {},
  locale: HatangLocale.tryParse(str(j, 'locale')),
  identifiedAt: dateOf(j, 'identified_at'),
  client: strOr(j, 'client', 'app'),
  app: mapOf(j, 'app') == null ? null : VisitorAppInfo.fromJson(mapOf(j, 'app')!),
  currentScreen: str(j, 'current_screen'),
  visits: intOr(j, 'visits', 1),
  raw: j,
);