fromMap static method

TrialFacts? fromMap(
  1. Map<String, dynamic> map
)

Returns null (the whole trial) when mode is missing/unknown — mirrors iOS.

Implementation

static TrialFacts? fromMap(Map<String, dynamic> map) {
  final raw = map['mode'] as String?;
  final mode = raw == null ? null : ZSTrialMode.fromRawValueOrNull(raw);
  if (mode == null) return null;
  return TrialFacts(
    mode: mode,
    duration: map['duration'] as String?,
    upfrontAmountCents: map['upfrontAmountCents'] as int? ?? 0,
    holdAmountCents: map['holdAmountCents'] as int? ?? 0,
    validatesCard: map['validatesCard'] as bool? ?? false,
  );
}