AuthResponse.fromJson constructor

AuthResponse.fromJson(
  1. Map<String, dynamic> data
)

Creates a response from a map

data The response data map

Implementation

factory AuthResponse.fromJson(Map<String, dynamic> data) {
  return AuthResponse(
    user: data['user'] as Map<String, dynamic>,
    accessToken: data['access_token'] as String?,
    refreshToken: data['refresh_token'] as String?,
    tokenType: data['token_type'] as String? ?? 'Bearer',
    expiresIn: data['expires_in'] as int?,
    refreshExpiresIn: data['refresh_expires_in'] as int?,
    metadata: data['metadata'] as Map<String, dynamic>?,
  );
}