InappifyAuthenticationResult.fromMap constructor

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

Decodes the documented, token-free authentication response.

Implementation

factory InappifyAuthenticationResult.fromMap(Map<String, dynamic> map) {
  final isAnonymous = map['isAnonymous'] ?? map['is_anonymous'];
  if (isAnonymous is! bool) {
    throw const FormatException(
      'Authentication result isAnonymous must be a boolean.',
    );
  }
  return InappifyAuthenticationResult(
    isAnonymous: isAnonymous,
    type: _nullableString(map['type'], 'type'),
    authenticatedAt: _nullableString(
      map['authenticatedAt'] ?? map['authenticated_at'],
      'authenticatedAt',
    ),
  );
}