LokotroOtpResendResponse.fromJson constructor
LokotroOtpResendResponse.fromJson(
- Map<String, dynamic> json
)
Implementation
factory LokotroOtpResendResponse.fromJson(Map<String, dynamic> json) {
// Handle both nested 'data' response format and flat response format
final data = json['data'] as Map<String, dynamic>? ?? json;
return LokotroOtpResendResponse(
success: data['success'] as bool? ?? json['success'] as bool? ?? false,
status: data['status'] as String? ?? json['status'] as String? ?? 'unknown',
otpSentTo: data['otp_sent_to'] as String? ?? json['otp_sent_to'] as String?,
resendCount: data['resend_count'] as int? ?? json['resend_count'] as int?,
maxResends: data['max_resends'] as int? ?? json['max_resends'] as int?,
resentAt: data['resent_at'] as String? ?? json['resent_at'] as String?,
expiresAt: data['expires_at'] as String? ?? json['expires_at'] as String?,
message: json['message'] as String? ?? data['message'] as String? ?? '',
);
}