fromJson static method

Call? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static Call? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return Call(
    id: (json['id'] as int?) ?? 0,
    uniqueId: (json['unique_id'] is int
            ? json['unique_id'] as int
            : int.tryParse(json['unique_id']?.toString() ?? '')) ??
        0,
    userId: (json['user_id'] as int?) ?? 0,
    isOutgoing: (json['is_outgoing'] as bool?) ?? false,
    isVideo: (json['is_video'] as bool?) ?? false,
    state: CallState.fromJson(json['state'] as Map<String, dynamic>?)!,
  );
}